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

<tfoot id='JxBF2'></tfoot>

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

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

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

        • <bdo id='JxBF2'></bdo><ul id='JxBF2'></ul>

        Kivy:使用 on_press 事件在屏幕管理器中更改屏幕

        Kivy: Changing screens in screen manager with an on_press event(Kivy:使用 on_press 事件在屏幕管理器中更改屏幕)
      1. <small id='UcPUD'></small><noframes id='UcPUD'>

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

            <i id='UcPUD'><tr id='UcPUD'><dt id='UcPUD'><q id='UcPUD'><span id='UcPUD'><b id='UcPUD'><form id='UcPUD'><ins id='UcPUD'></ins><ul id='UcPUD'></ul><sub id='UcPUD'></sub></form><legend id='UcPUD'></legend><bdo id='UcPUD'><pre id='UcPUD'><center id='UcPUD'></center></pre></bdo></b><th id='UcPUD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UcPUD'><tfoot id='UcPUD'></tfoot><dl id='UcPUD'><fieldset id='UcPUD'></fieldset></dl></div>
                <tbody id='UcPUD'></tbody>
              <legend id='UcPUD'><style id='UcPUD'><dir id='UcPUD'><q id='UcPUD'></q></dir></style></legend>
                  本文介紹了Kivy:使用 on_press 事件在屏幕管理器中更改屏幕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想知道如何使用綁定到按鈕的 on_press 事件來更改屏幕,而不使用 KV 文件/KV 語言.

                  I would like to know how to change screens using an on_press event binded to a button, without using a KV file/KV language.

                  我已通讀 Kivy 文檔,但只能使用 KV 文件找到解決方案.

                  I have read through the Kivy documentation, but have only been able to find solutions using a KV file.

                  例子:

                  on_press: root.manager.current = 'screen2'

                  我還可以使用以下方法更改主 python 文件中的屏幕:

                  I can also change the screen in the main python file using:

                  screenmanager.current = 'screen2'

                  但我不知道如何使用按鈕來達到同樣的效果.

                  But I cant figure out how to achieve the same using a button.

                  推薦答案

                  實現此目的的一種簡單方法是定義自己的按鈕子類:

                  One simple way to accomplish this is to define your own button subclass:

                  class ScreenButton(Button):
                      screenmanager = ObjectProperty()
                      def on_press(self, *args):
                          super(ScreenButton, self).on_press(*args)
                          self.screenmanager.current = 'whatever'
                  

                  按下按鈕時會自動調用on_press方法,所以會改變screenmanager的current屬性.

                  The on_press method is automatically called when the button is pressed, so the screenmanager's current property will be changed.

                  然后你可以有類似的代碼:

                  Then you can have code something like:

                  sm = ScreenManager()
                  
                  sc1 = Screen(name='firstscreen')
                  sc1.add_widget(ScreenButton(screenmanager=sm))
                  
                  sc2 = Screen(name='whatever')
                  sc2.add_widget(Label(text='another screen'))
                  
                  sm.add_widget(sc1)
                  sm.add_widget(sc2)
                  

                  單擊按鈕應根據需要切換屏幕.

                  Clicking the button should switch the screens as required.

                  另一種方式(這可能是 kv 語言實際的做法)是手動使用 bind 方法.

                  Another way (which is probably how kv language actually does it) would be to manually use the bind method.

                  def switching_function(*args):
                      some_screen_manager.current = 'whatever'
                  
                  some_button.bind(on_press=switching_function)
                  

                  這意味著只要按下 some_button 就會調用 switching_function.當然,關于如何以及何時定義函數,這里有很大的靈活性,因此(例如)您可以做一些更一般的事情,比如將屏幕管理器作為第一個參數傳遞給函數.

                  This would mean that switching_function is called whenever some_button is pressed. Of course there is a lot of flexibility here regarding how and when you define the function, so (for instance) you could do something more general like pass the screenmanager as the first argument to the function.

                  我沒有測試這段代碼,它不是一個完整的應用程序,但希望含義清楚.任何一種方法都應該可以正常工作,您可以選擇看起來最明智的方法.稍后我可能會構建一個更完整的示例.

                  I didn't test this code and it isn't a complete app, but hopefully the meaning is clear. Either method should work fine, you can choose the way that seems most sensible. I might construct a more complete example later.

                  這篇關于Kivy:使用 on_press 事件在屏幕管理器中更改屏幕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='CiAiB'></bdo><ul id='CiAiB'></ul>
                      <legend id='CiAiB'><style id='CiAiB'><dir id='CiAiB'><q id='CiAiB'></q></dir></style></legend>
                    • <i id='CiAiB'><tr id='CiAiB'><dt id='CiAiB'><q id='CiAiB'><span id='CiAiB'><b id='CiAiB'><form id='CiAiB'><ins id='CiAiB'></ins><ul id='CiAiB'></ul><sub id='CiAiB'></sub></form><legend id='CiAiB'></legend><bdo id='CiAiB'><pre id='CiAiB'><center id='CiAiB'></center></pre></bdo></b><th id='CiAiB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CiAiB'><tfoot id='CiAiB'></tfoot><dl id='CiAiB'><fieldset id='CiAiB'></fieldset></dl></div>

                        <tfoot id='CiAiB'></tfoot>
                          <tbody id='CiAiB'></tbody>

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

                          1. 主站蜘蛛池模板: 日韩中文字幕 | 国产精品一区二区久久久久 | 伊人久久一区二区 | 中文字幕亚洲欧美日韩在线不卡 | 久久伦理电影 | av天天干| 亚洲国产欧美精品 | 亚洲福利一区二区 | 久久伊人影院 | 亚洲国产一 | www日韩高清| 亚洲国产精品成人 | 精品1区2区 | 成人在线观看免费爱爱 | 成人午夜免费在线视频 | 欧美亚洲第一区 | 中文字幕综合 | 欧美日韩福利 | 国产成人精品免高潮在线观看 | 欧美精品一区二区三区蜜桃视频 | 国产精品视频999 | 亚洲精品区 | 欧美在线观看一区 | 国产乱一区二区三区视频 | 中文字幕精品一区二区三区在线 | 波霸ol一区二区 | 国产精品久久国产精品 | 亚洲欧美一区二区三区在线 | 色综合一区二区 | 黄色大片在线播放 | 欧美婷婷| 亚洲精品一区二三区不卡 | 中国一级特黄毛片大片 | 欧美一级二级视频 | 日本一区二区三区在线观看 | 亚洲在线| 亚洲电影成人 | 国产一区 | 免费艹逼视频 | 成人欧美一区二区三区黑人孕妇 | 91精品久久久久久久久 |