久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='FOBTn'></small><noframes id='FOBTn'>

    <legend id='FOBTn'><style id='FOBTn'><dir id='FOBTn'><q id='FOBTn'></q></dir></style></legend>
  1. <tfoot id='FOBTn'></tfoot>

  2. <i id='FOBTn'><tr id='FOBTn'><dt id='FOBTn'><q id='FOBTn'><span id='FOBTn'><b id='FOBTn'><form id='FOBTn'><ins id='FOBTn'></ins><ul id='FOBTn'></ul><sub id='FOBTn'></sub></form><legend id='FOBTn'></legend><bdo id='FOBTn'><pre id='FOBTn'><center id='FOBTn'></center></pre></bdo></b><th id='FOBTn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FOBTn'><tfoot id='FOBTn'></tfoot><dl id='FOBTn'><fieldset id='FOBTn'></fieldset></dl></div>
      <bdo id='FOBTn'></bdo><ul id='FOBTn'></ul>

    1. 如何為每個屏幕添加一個自己的 .py 和 .kv 文件

      How to add for each screen an own .py and .kv file?(如何為每個屏幕添加一個自己的 .py 和 .kv 文件?)
      • <bdo id='SapDA'></bdo><ul id='SapDA'></ul>

          <legend id='SapDA'><style id='SapDA'><dir id='SapDA'><q id='SapDA'></q></dir></style></legend>
            <tbody id='SapDA'></tbody>

          <i id='SapDA'><tr id='SapDA'><dt id='SapDA'><q id='SapDA'><span id='SapDA'><b id='SapDA'><form id='SapDA'><ins id='SapDA'></ins><ul id='SapDA'></ul><sub id='SapDA'></sub></form><legend id='SapDA'></legend><bdo id='SapDA'><pre id='SapDA'><center id='SapDA'></center></pre></bdo></b><th id='SapDA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SapDA'><tfoot id='SapDA'></tfoot><dl id='SapDA'><fieldset id='SapDA'></fieldset></dl></div>
          <tfoot id='SapDA'></tfoot>

            1. <small id='SapDA'></small><noframes id='SapDA'>

                本文介紹了如何為每個屏幕添加一個自己的 .py 和 .kv 文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我希望每個屏幕都有一個單獨的 .py 和 .kv 文件.在 main.py/main.kv 中的 ScreenManager 上應該選擇屏幕.設計應從文件 screen_X.kv 加載,類等應從文件 screen_X.py 加載.

                I want to have a seperate .py and .kv file for each sreen. Over the ScreenManager in main.py/main.kv the screen should be selected. The design should be loaded from the file screen_X.kv and the classes etc. should be loaded from the file screen_X.py.

                屏幕:

                • 屏幕 1
                • 屏幕 2
                • 屏幕 3

                文件:

                • (main.py)
                • (showcase.kv)
                • screen_1.py
                • screen_1.kv
                • screen_2.py
                • screen_2.kv
                • screen_3.py
                • screen_3.kv

                這使得程序可以很容易地擴展.我怎樣才能做到這一點?

                This makes the program can be easily extended. How can I achieve this?

                使用此代碼,我已經分離了 .kv 文件.但我還需要單獨的 .py 文件.

                With this code I have seperated .kv files. But I need also separated .py files.

                main.py

                from time import time
                from kivy.app import App
                from os.path import dirname, join
                from kivy.lang import Builder
                from kivy.properties import NumericProperty, BooleanProperty, ListProperty
                from kivy.clock import Clock
                from kivy.uix.screenmanager import Screen
                
                
                class ShowcaseScreen(Screen):
                    fullscreen = BooleanProperty(False)
                
                    def add_widget(self, *args):
                        if 'content' in self.ids:
                            return self.ids.content.add_widget(*args)
                        return super(ShowcaseScreen, self).add_widget(*args)
                
                
                class ShowcaseApp(App):
                    time = NumericProperty(0)
                    screen_names = ListProperty([])
                    bool_menu = BooleanProperty(False)
                
                    def build(self):
                        self.title = 'hello world'
                        Clock.schedule_interval(self._update_clock, 1 / 60.)
                        self.available_screens = [
                            'Buttons', 'CheckBoxes', 'ProgressBar', 'Switches', 'ToggleButton',
                        ]
                        self.screen_names = self.available_screens
                        curdir = dirname(__file__)
                        self.available_screens = [join(curdir, 'data', 'screens', '{}.kv'.format(fn)) for fn in self.available_screens]
                
                        self.menu_screen = join(curdir, 'data', 'screens', '{}.kv'.format('Menu'))
                
                        self.go_menu()
                
                    def go_screen(self, idx):
                        screen = Builder.load_file(self.available_screens[idx])
                        self.root.ids.sm.switch_to(screen, direction='left')
                
                    def go_menu(self):
                        if not self.bool_menu:
                            screen = Builder.load_file(self.menu_screen)
                            self.root.ids.sm.switch_to(screen, direction='right')
                
                    def _update_clock(self, dt):
                        self.time = time()
                
                if __name__ == '__main__':
                    ShowcaseApp().run()
                

                showcase.kv

                showcase.kv

                #:kivy 1.8.0
                #:import KivyLexer kivy.extras.highlight.KivyLexer
                #:import Factory kivy.factory.Factory
                
                <ActionSpinnerOptions@SpinnerOption>
                    background_color: .4, .4, .4, 1
                
                <ActionSpinner@Spinner+ActionItem>
                    canvas.before:
                        Color:
                            rgba: 0.128, 0.128, 0.128, 1
                        Rectangle:
                            size: self.size
                            pos: self.pos
                    border: 27, 20, 12, 12
                    background_normal: 'atlas://data/images/defaulttheme/action_group'
                    option_cls: Factory.ActionSpinnerOptions
                
                <ActionDropdown>:
                    on_size: self.width = '220dp'
                
                <ShowcaseScreen>:
                    ScrollView:
                        do_scroll_x: False
                        do_scroll_y: False if root.fullscreen else (content.height > root.height - dp(16))
                        AnchorLayout:
                            size_hint_y: None
                            height: root.height if root.fullscreen else max(root.height, content.height)
                            GridLayout:
                                id: content
                                cols: 1
                                spacing: '8dp'
                                padding: '8dp'
                                size_hint: (1, 1) if root.fullscreen else (.8, None)
                                height: self.height if root.fullscreen else self.minimum_height
                
                
                BoxLayout:
                    orientation: 'vertical'
                
                    canvas.before:
                        Color:
                            rgb: .6, .6, .6
                        Rectangle:
                            size: self.size
                            source: 'data/background.png'
                
                    ActionBar:
                
                        ActionView:
                            id: av
                            ActionPrevious:
                                with_previous: (False if app.bool_menu == True else True) if not app.bool_menu else False
                                title: 'Menu'
                                on_release: app.go_menu()
                
                            ActionSpinner:
                                id: spnr
                                important: True
                                text: 'Select Program'
                                values: app.screen_names
                                on_text:
                                    if (spnr.text != 'Select Program') and (sm.current != args[1]):
                                    idx = app.screen_names.index(args[1]);
                                    app.go_screen(idx)
                
                    ScreenManager:
                        id: sm
                        on_current_screen:
                            screen_name = args[1].name
                
                            spnr.text = 'Select Program' if screen_name == 'Menu' else screen_name
                
                            if screen_name == 'Menu': app.bool_menu = True
                            else: app.bool_menu = False
                

                推薦答案

                首先,你沒有提到你是否知道如何按通常的方式設置不同的屏幕,我不確定我在上面的代碼.如果您不這樣做,這里有一個相當簡單的教程來創建一個簡單的多屏幕設置.

                First of all, you haven't mentioned whether you know how to set up different screens the usual way, and I'm not sure that I see it in the code above. In case you don't, there is a fairly simple tutorial here on creating a simple multi-screen setup.

                每個屏幕都是繼承自 Screen 的類,只需在單獨的 .py 文件中定義這些屏幕類,然后將它們導入到您的 main.py 文件中,這并不是一件難事.我以前做過.例如,我有我的 main.py(你需要它),我在一個名為game_screen.py"的 py 文件中定義了我所有的各種屏幕,并從那里簡單地導入.

                Each screen being a class that inherits from Screen, it isn't a difficult thing to just define those screen classes in seperate .py files and then import them into your main.py file. I have done this before. For instance, I had my main.py(which you need), and I had all my various screens defined in a py file called 'game_screen.py', and simply imported from there.

                我自己并沒有看到過多使用多個 kv 文件,但我知道您可以使用與下面類似的代碼將 kv 規則添加到您的主(默認)kv 文件規則中.盡管我相信這些規則必須在它們生效的小部件之前加載才能正常工作.

                I haven't seen much use of multiple kv files myself, but I know you can add kv rules to your main(default) kv files rules using similar code to the below. Though these rules, I believe, must be loaded before the widgets they will effect in order to work correctly.

                from kivy.lang import Builder
                Builder.load_file('screen1.kv')
                Builder.load_file('screen2.kv')
                Builder.load_file('screen3.kv')
                

                因此,通過將您的屏幕類導入您的 main.py 并使用上述添加 kv 文件的方法,您可能會實現您的要求......然后決定這是否是一個好方法.

                So by importing your screen classes to your main.py and using the above method of adding kv files, you could probably achieve what you are asking for.. and then decide if that's a good way to go.

                這篇關于如何為每個屏幕添加一個自己的 .py 和 .kv 文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                message.channel.id Discord PY(message.channel.id Discord PY)
                How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                    <bdo id='Tx1jo'></bdo><ul id='Tx1jo'></ul>
                    <tfoot id='Tx1jo'></tfoot>

                      <tbody id='Tx1jo'></tbody>
                  • <i id='Tx1jo'><tr id='Tx1jo'><dt id='Tx1jo'><q id='Tx1jo'><span id='Tx1jo'><b id='Tx1jo'><form id='Tx1jo'><ins id='Tx1jo'></ins><ul id='Tx1jo'></ul><sub id='Tx1jo'></sub></form><legend id='Tx1jo'></legend><bdo id='Tx1jo'><pre id='Tx1jo'><center id='Tx1jo'></center></pre></bdo></b><th id='Tx1jo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Tx1jo'><tfoot id='Tx1jo'></tfoot><dl id='Tx1jo'><fieldset id='Tx1jo'></fieldset></dl></div>

                        • <small id='Tx1jo'></small><noframes id='Tx1jo'>

                          <legend id='Tx1jo'><style id='Tx1jo'><dir id='Tx1jo'><q id='Tx1jo'></q></dir></style></legend>
                          主站蜘蛛池模板: 99视频在线播放 | 91精品无人区卡一卡二卡三 | 亚洲免费影院 | 欧美一区二区成人 | 欧美一区二区三区免费电影 | 黄色一级大片在线观看 | 久久伊人免费视频 | 婷婷色国产偷v国产偷v小说 | 国产高清在线精品一区二区三区 | 婷婷色在线播放 | 国产精品激情 | 国产1区| 欧美成人在线网站 | 亚洲一区二区三区在线视频 | 成人a视频在线观看 | 香蕉久久久 | 99视频在线免费观看 | 请别相信他免费喜剧电影在线观看 | 日韩电影一区 | 日本 欧美 国产 | 天天操天天摸天天爽 | 亚洲高清在线 | 亚洲高清中文字幕 | 毛片区| 国产激情亚洲 | 97影院2| h小视频| 欧美日韩综合一区 | 日韩精品久久 | 91福利网址 | 亚洲第1页 | 精品成人一区二区 | 久久国产精品-久久精品 | 国产精品色婷婷久久58 | 色橹橹欧美在线观看视频高清 | 久久在看 | 二区国产 | 国产超碰人人爽人人做人人爱 | 欧美国产精品一区二区三区 | 亚洲高清视频一区二区 | 国产成人精品久久 |