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


Python floatlayout.FloatLayout方法代码示例

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


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

示例1: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):

            # test with FboFloatLayout or FloatLayout
            # comment/uncomment to test it
            root = FboFloatLayout()
            #root = FloatLayout()

            # this part of creation can be slow. try to optimize the loop a
            # little bit.
            s = 30
            size = (s, s)
            sh = (None, None)
            add = root.add_widget
            print('Creating 5000 widgets...')
            for i in range(5000):
                x = (i % 40) * s
                y = int(i / 40) * s
                add(Button(text=str(i), pos=(x, y), size_hint=sh, size=size))
                if i % 1000 == 1000 - 1:
                    print(5000 - i - 1, 'left...')

            return root 
开发者ID:kpiorno,项目名称:kivy3dgui,代码行数:24,代码来源:fbowidget.py

示例2: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):
            root = FloatLayout()
            self.sm = sm = ScreenManager(transition=SwapTransition())

            sm.add_widget(Screen(name='test1'))
            sm.add_widget(Screen(name='test2'))

            btn = Button(size_hint=(None, None))
            btn.bind(on_release=self.change_view)

            btn2 = Button(size_hint=(None, None), x=100)
            btn2.bind(on_release=self.remove_screen)

            root.add_widget(sm)
            root.add_widget(btn)
            root.add_widget(btn2)
            return root 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:19,代码来源:screenmanager.py

示例3: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):
        EventLoop.ensure_window()
        layout = FloatLayout()
        if self.figure:
            self.figure.size_hint_y = 0.9
            layout.add_widget(self.figure)
        if self.toolbar:
            self.toolbar.size_hint_y = 0.1
            layout.add_widget(self.toolbar)
        return layout 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:12,代码来源:backend_kivyagg.py

示例4: __init__

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def __init__(self, **kw):
        self.content = FloatLayout()
        super(ScatterLayout, self).__init__(**kw)
        if self.content.size != self.size:
            self.content.size = self.size
        super(ScatterLayout, self).add_widget(self.content)
        self.bind(size=self.update_size) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:9,代码来源:scatterlayout.py

示例5: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):
            root = FloatLayout()
            bx = BoxLayout()
            bx.add_widget(Button())
            bx.add_widget(Button())
            bx2 = BoxLayout()
            bx2.add_widget(Button())
            bx2.add_widget(Button())
            bx2.add_widget(Button())
            spl = Splitter(
                size_hint=(1, .25),
                pos_hint = {'top': 1},
                sizable_from = 'bottom')
            spl1 = Splitter(
                sizable_from='left',
                size_hint=(None, 1), width=90)
            spl1.add_widget(Button())
            bx.add_widget(spl1)
            spl.add_widget(bx)

            spl2 = Splitter(size_hint=(.25, 1))
            spl2.add_widget(bx2)
            spl2.sizable_from = 'right'
            root.add_widget(spl)
            root.add_widget(spl2)
            return root 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:28,代码来源:splitter.py

示例6: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):
            main_widget = Builder.load_string("""
#:import MDRaisedButton kivymd.button.MDRaisedButton
#:import MDThemePicker kivymd.theme_picker.MDThemePicker
FloatLayout:
    MDRaisedButton:
        size_hint: None, None
        pos_hint: {'center_x': .5, 'center_y': .5}
        size: 3 * dp(48), dp(48)
        center_x: self.parent.center_x
        text: 'Open theme picker'
        on_release: MDThemePicker().open()
        opposite_colors: True
""")
            return main_widget 
开发者ID:kiok46,项目名称:Blogs-Posts-Tutorials,代码行数:17,代码来源:theme_picker.py

示例7: build

# 需要导入模块: from kivy.uix import floatlayout [as 别名]
# 或者: from kivy.uix.floatlayout import FloatLayout [as 别名]
def build(self):

        data_dir = getattr(self, 'user_data_dir') #get a writable path to save our score
        self.store = JsonStore(join(data_dir, 'score.json')) # create a JsonScore file in the available location

        if(not self.store.exists('score')): # if there is no file, we need to save the best score as 1
            self.store.put('score', best=1)

        if platform() == 'android': # if we are on Android, we can initialize the ADs service
            revmob.start_session('54c247f420e1fb71091ad44a')

        self.screens = {} # list of app screens
        self.screens['menu'] = MenuScreen(self) #self the MainApp instance, so others objects can change the screen
        self.screens['game'] = GameScreen(self)
        self.root = FloatLayout()

        self.open_screen('menu')

        self.sound = SoundLoader.load('res/background.mp3') # open the background music
        # kivy support music loop, but it was not working on Android. I coded in a different way to fix it
        # but if fixed, we can just set the loop to True and call the play(), so it'll auto repeat
        # self.sound.loop = True It # was not working on android, so I wrote the following code:
        self.sound.play() # play the sound
        Clock.schedule_interval(self.check_sound, 1) #every second force the music to be playing

        return self.root

    # play the sound 
开发者ID:aron-bordin,项目名称:Kivy-Tutorials,代码行数:30,代码来源:main.py


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