当前位置: 首页>>代码示例>>Python>>正文


Python Carousel.cols方法代码示例

本文整理汇总了Python中kivy.uix.carousel.Carousel.cols方法的典型用法代码示例。如果您正苦于以下问题:Python Carousel.cols方法的具体用法?Python Carousel.cols怎么用?Python Carousel.cols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.uix.carousel.Carousel的用法示例。


在下文中一共展示了Carousel.cols方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_activated

# 需要导入模块: from kivy.uix.carousel import Carousel [as 别名]
# 或者: from kivy.uix.carousel.Carousel import cols [as 别名]
    def on_activated(self,*args):
        super(VirtualScreenManagerStack, self).on_activated(*args)
        print 'on activated', self.activated, self.current_screen
        SCALE = .6 if self.activated else 1
        if self.activated:
            self.clear_widgets()
            grid = Carousel(size_hint = (1,1), width=.8*Window.width, x=.1*Window.width, direction="bottom")
            FloatLayout.add_widget(self,grid)
        for wrapper in self.wrappers.values():
            print 'before', wrapper.size
            wrapper.scale=SCALE
            print 'after', wrapper.size
            if self.activated:
                wrapper.size_hint= None, None
                print 'adding wrapper of ', wrapper.height
                grid.add_widget(wrapper)
            else:
                self.children[0].remove_widget(wrapper)
        if not self.activated:
            self.clear_widgets()
            w= self.wrappers[self.current_screen]
            w.pos = 0,0
            w.size_hint= 1,1
            FloatLayout.add_widget(self, w)
        else:
            print "grid", grid.size, grid.pos, grid.size_hint
        return
        if 0:
            self.clear_widgets()
            sv = ScrollView()
            with sv.canvas.before:
                Color(.3,.3,.3)
                Rectangle(size=self.size, pos=self.pos)
            FloatLayout.add_widget(self,sv)
            grid= GridLayout()
            sv.do_scroll_x = self.activated
            sv.do_scroll_y = self.activated
            grid.rows = 1 if self.orientation=='horizontal' else None
            grid.cols = 1 if self.orientation=="vertical" else None
            grid.bind(minimum_height = grid.setter('height'))
            grid.bind(minimum_width = grid.setter('width'))
            grid.spacing = self.spacing
            sv.add_widget(grid)
            SCALE = .6
                        # if self.orientation == 'vertical':
                        #     attrName = "cols"
                        #     dh_name = "row_default_height"
                        #     default_value = SCALE*self.height #300
                        #     size_hint=(1,None)
                        # else:
                        #     attrName = "rows"
                        #     dh_name = "col_default_width"
                        #     default_value = 400
                        #     size_hint=(None,1)
                        # kwargs = {attrName:2, dh_name:default_value}
                        # kwargs = {attrName:2}
                        # kwargs = {attrName:1}
                        # kwargs = {attrName:1, dh_name:default_value}
                        # if self.orientation == 'vertical':
                        #     grid.height = len(self.content)*(SCALE*self.height+self.spacing)
                        # else:
                        #     grid.width = len(self.content)*(SCALE*self.width + self.spacing)
            for sindex, screen in enumerate(self.content):
                wrapper = self.wrappers[screen]
                wrapper.size_hint = None,None
                wrapper.size = self.size
                if 1 or screen != self.current_screen:
                    wrapper.scale = SCALE
                else:
                    reducer = Animation(scale=SCALE, opacity=.5, duration=.3)
                    reducer.start(wrapper)
                grid.add_widget(wrapper)
                #Clock.schedule_once(adder,.31)
                #if self.orientation=='vertical':
                #    name = wrapper.screen_name or str(screen)
                #    grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_x=None, width=60))
            ##if self.orientation =="horizontal":
            ##    for screen in self.content:
            ##        name = wrapper.screen_name or str(screen)
            ##        grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_y=None, height=30))
            #scrool sv to proper height
            ##if self.orientation=="vertical":
            ##    sv.scroll_y= 1- float(self.content.index(self.current_screen))/len(self.content)
            ##else:
            ##    sv.scroll_x= float(self.content.index(self.current_screen))/len(self.content)

        else:
            sv = self.children[0]
            grid = sv.children[0]
            for screen in self.content:
                wrapper = self.wrappers[screen]
                grid.remove_widget(wrapper)
            self.clear_widgets()
            w = self.wrappers[self.current_screen]
            w.size_hint = 1,1
            FloatLayout.add_widget(self,w)
            wrapper = self.wrappers[self.current_screen]
            expander = Animation(scale = 1, opacity=1, x=0, y=0, duration=.3)
            expander.start(wrapper)
开发者ID:opqopq,项目名称:BoardGameMaker,代码行数:101,代码来源:virtual_screen.py


注:本文中的kivy.uix.carousel.Carousel.cols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。