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

<legend id='Emg09'><style id='Emg09'><dir id='Emg09'><q id='Emg09'></q></dir></style></legend>

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

  1. <tfoot id='Emg09'></tfoot>

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

      Kivy 時鐘和彈出窗口

      Kivy Clock and Popup(Kivy 時鐘和彈出窗口)

        <tbody id='DuJqE'></tbody>
    1. <small id='DuJqE'></small><noframes id='DuJqE'>

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

            <bdo id='DuJqE'></bdo><ul id='DuJqE'></ul>

              • <tfoot id='DuJqE'></tfoot>
                <legend id='DuJqE'><style id='DuJqE'><dir id='DuJqE'><q id='DuJqE'></q></dir></style></legend>
              • 本文介紹了Kivy 時鐘和彈出窗口的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                如何正確地為 switch_id 和 switch_id_popup 創(chuàng)建活動屬性,以便可以使用 kivy 時鐘在 timer_loop 內(nèi)創(chuàng)建條件語句?

                How do I properly create active properties for switch_id and switch_id_popup so I can create a conditional statement inside of timer_loop with kivy clock?

                我在一個類似問題上得到了很好的反饋(再次感謝 eyllanesc),但由于涉及到彈出窗口,我無法采納建議.

                I got great feedback on a similar question(thanks again eyllanesc), but I am unable to incorporate advice now that popup is involved.

                下面是說明我的問題的草圖.我已經(jīng)用箭頭標識了所有有問題的區(qū)域.預(yù)先感謝您的任何幫助.

                Below is a sketch that illustrates my issue. I have identified all of the areas in question with arrows. Thank you in advance for any help.

                from kivy.app import App
                from kivy.lang import Builder
                from kivy.clock import Clock
                import time
                from kivy.uix.popup import Popup
                
                theRoot = Builder.load_string('''
                
                <CustomPopup1>:
                
                    StackLayout:
                        active2: switch_id_popup.active #<---- switch_id_popup declared here(active2)
                
                
                        Switch:                         #<---- This switch (switch_id_popup)
                            id: switch_id_popup
                            size_hint: .5, .5
                            active: switch_id_popup.active
                
                        Button:
                            text: 'Close'
                            on_release: root.dismiss()
                            size_hint: .5, .5
                
                
                
                StackLayout:
                    active1: switch_id.active           #<---- switch_id declared here(active1)
                    orientation: 'lr-tb'
                    padding: 10
                    spacing: 5
                
                
                    Label:
                        text: "Zone 1 Valve"
                        size_hint: .25, .1
                
                    Switch:                             #<---- This switch (switch_id)
                        id: switch_id
                        size_hint: .25, .1
                        active: switch_id.active
                
                
                    Button:
                        text: "Program 1"
                        on_press: app.open_popup1()
                        size_hint: .5,.1
                
                ''')
                
                
                class CustomPopup1(Popup):
                    pass
                
                class theApp(App):
                
                
                    def build(self):
                        Clock.schedule_interval(self.timer_loop, 2)
                        return theRoot
                
                
                    def timer_loop(self, dt):  
                
                        if theRoot.active1 and theRoot.active2: #<---- How do I make this work if switch_id_popup is within a popup?
                            print("Do something")
                        else:
                            print("Do nothing")
                
                    def open_popup1(self):
                        the_popup = CustomPopup1()
                        the_popup.open()
                
                
                if __name__ == '__main__':
                    theApp().run()
                

                推薦答案

                正如我在我之前的解決方案中提到的,你應(yīng)該將每個類視為一個黑盒,并公開允許您獲取和建立值的屬性.對于 Popup,active 屬性必須是類的一部分,而不是內(nèi)部 StackLayout.另一方面,在 open_popup 方法中,您總是在創(chuàng)建一個新的 Popup,當您關(guān)閉它時將刪除它,使該屬性不可訪問,因此我們推斷必須有一個具有更大范圍的 Popup 對象,因為它必須在外部創(chuàng)建App 類的成員或成為它的成員.最后,active2 不是 theRoot 的屬性.

                As I mentioned in my previous solution, you should consider each class as a black box and expose properties that allow you to obtain and establish values. In the case of Popup, the active property must be part of the class and not the internal StackLayout. On the other hand in the open_popup method you are always creating a new Popup that will be deleted when you close it making the property is not accessible, so we deduce that there must be a Popup object with a larger scope for it must be created outside of theApp class or be a member of it. Lastly, active2 is not a property of theRoot.

                綜合以上,得到如下解決方案:

                Considering the above, the following solution is obtained:

                from kivy.app import App
                from kivy.lang import Builder
                from kivy.clock import Clock
                import time
                from kivy.uix.popup import Popup
                
                theRoot = Builder.load_string('''
                <CustomPopup>:
                    active: switch_id_popup.active
                    StackLayout:
                        Switch:
                            id: switch_id_popup
                            size_hint: .5, .5
                        Button:
                            text: 'Close'
                            on_release: root.dismiss()
                            size_hint: .5, .5
                
                StackLayout:
                    active: switch_id.active
                    orientation: 'lr-tb'
                    padding: 10
                    spacing: 5
                    Label:
                        text: "Zone 1 Valve"
                        size_hint: .25, .1
                    Switch:
                        id: switch_id
                        size_hint: .25, .1
                    Button:
                        text: "Program 1"
                        on_press: app.open_popup()
                        size_hint: .5,.1
                
                ''')
                
                class CustomPopup(Popup):
                    pass
                
                
                class TheApp(App):
                    def build(self):
                        self.the_popup = CustomPopup()
                        Clock.schedule_interval(self.timer_loop, 2)
                        return theRoot
                
                    def timer_loop(self, dt):  
                        if self.root.active and self.the_popup.active:
                            print("Do something")
                        else:
                            print("Do nothing")
                
                    def open_popup(self):
                        self.the_popup.open()
                
                
                if __name__ == '__main__':
                    TheApp().run()
                

                這篇關(guān)于Kivy 時鐘和彈出窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                Discord bot isn#39;t responding to commands(Discord 機器人沒有響應(yīng)命令)
                Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?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 - 自動更改角色顏色)

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

              • <tfoot id='icpR0'></tfoot>

                  <legend id='icpR0'><style id='icpR0'><dir id='icpR0'><q id='icpR0'></q></dir></style></legend>

                    1. <i id='icpR0'><tr id='icpR0'><dt id='icpR0'><q id='icpR0'><span id='icpR0'><b id='icpR0'><form id='icpR0'><ins id='icpR0'></ins><ul id='icpR0'></ul><sub id='icpR0'></sub></form><legend id='icpR0'></legend><bdo id='icpR0'><pre id='icpR0'><center id='icpR0'></center></pre></bdo></b><th id='icpR0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='icpR0'><tfoot id='icpR0'></tfoot><dl id='icpR0'><fieldset id='icpR0'></fieldset></dl></div>
                        <bdo id='icpR0'></bdo><ul id='icpR0'></ul>
                            <tbody id='icpR0'></tbody>
                          主站蜘蛛池模板: 国产激情免费视频 | 国内精品久久久久久 | 中文字幕在线一区二区三区 | 亚洲二区精品 | aaaaaaa片毛片免费观看 | 影音先锋成人资源 | 亚洲精品2区 | 欧美色成人 | 久久网亚洲 | 黄久久久 | 国产一区h | 男人的天堂在线视频 | 亚洲精品丝袜日韩 | 黑人巨大精品欧美黑白配亚洲 | www.男人天堂.com | 亚洲电影一区 | 日韩免费高清视频 | 日韩在线视频免费观看 | 午夜在线视频一区二区三区 | 亚洲精品在线免费观看视频 | 亚洲高清免费视频 | 久久久久久久久久影视 | 精品久久久久久亚洲精品 | 1级毛片 | 中文字幕1区2区3区 亚洲国产成人精品女人久久久 | aaa在线 | 久久99精品久久久久久国产越南 | 国产精品免费一区二区三区四区 | 日韩一区二区不卡 | 日本久久黄色 | 亚洲欧美视频一区 | 精品欧美色视频网站在线观看 | 欧美女优在线观看 | 日本黄色短片 | 亚洲精品在线观 | 九九九视频在线 | 欧美色性 | 久久亚洲天堂 | 欧美日韩一区在线观看 | 成年人黄色小视频 | 91精品国产综合久久香蕉922 |