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

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

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

        <legend id='vHjUx'><style id='vHjUx'><dir id='vHjUx'><q id='vHjUx'></q></dir></style></legend>
      1. 運行代碼時更新 kivy 小部件的屬性

        Update properties of a kivy widget while running code(運行代碼時更新 kivy 小部件的屬性)
        <i id='BBiN1'><tr id='BBiN1'><dt id='BBiN1'><q id='BBiN1'><span id='BBiN1'><b id='BBiN1'><form id='BBiN1'><ins id='BBiN1'></ins><ul id='BBiN1'></ul><sub id='BBiN1'></sub></form><legend id='BBiN1'></legend><bdo id='BBiN1'><pre id='BBiN1'><center id='BBiN1'></center></pre></bdo></b><th id='BBiN1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BBiN1'><tfoot id='BBiN1'></tfoot><dl id='BBiN1'><fieldset id='BBiN1'></fieldset></dl></div>
            <bdo id='BBiN1'></bdo><ul id='BBiN1'></ul>
              <tbody id='BBiN1'></tbody>

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

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

                  <tfoot id='BBiN1'></tfoot>

                  本文介紹了運行代碼時更新 kivy 小部件的屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想在運行某些東西時更新 kivy 小部件的屬性...

                  I want to update the properties of a kivy widget while running something...

                  例子:

                  class app(App):
                      def build(self):
                          self.layout = Layout()
                          self.name = Label(text = "john")
                          self.layout.add_widget(self.name)
                          return self.layout
                  
                      def update(self):
                          for i in range(50): #keep showing the update
                              self.name.text = str(i)
                              #maybe some sleep here
                  
                  obj = app()
                  obj.run()
                  obj.update()
                  

                  這只會顯示循環的最終結果.我想在循環進行時繼續更新 label.text.

                  This is gonna show me only the final result of the loop. I'd like to keep updating the label.text while the loop goes.

                  我尋找了類似 bind()、setter() 和 ask_update() 函數,但如果是這些函數,我不知道如何使用它們.

                  I looked for something like the bind(), setter() and ask_update() functions, but if are these funcs, I didn't get how to use them.

                  ------------------ 編輯 -----------------------

                  ------------------ EDIT -----------------------

                  試圖適應 inclement 答案(使用時鐘在其他線程中運行更新函數),我得到下面的代碼試圖遵循我的問題的真實想法,但仍然無法正常工作:

                  Trying to adapt to inclement answer (running the update function in other thread using Clock), I got the code below trying to follow the real idea of my problem, but still not working:

                  class main():
                      def __init__(self, app):
                          self.app = app
                  
                      ... some code goes here ...
                  
                      def func(self):
                          Clock.schedule_once(partial(self.app.update, self.arg_1, self.arg_2), 0)
                  
                  class app(App):
                      def build(self):
                              self.main = main(self)
                              self.layout = Layout()
                              self.name = Label(text = "john")
                              self.layout.add_widget(self.name)
                              return self.layout
                  
                      ... some code goes here ...
                  
                      def update(self, dt, arg_1, arg_2):
                          self.name = arg_1
                          sleep(5)
                          self.name = arg_2
                  
                  obj = app()
                  obj.run()
                  

                  我需要調用 func 函數并使其在 update 函數中命令文本更改時準確地更新標簽文本.

                  I need to call the funcfunction and make it update the label text exactly when I order the text change in update function.

                  推薦答案

                  你需要避免阻塞主線程.在大多數情況下,只使用 kivy 的時鐘很方便.您可以執行以下操作.

                  You need to avoid blocking the main thread. In most cases, it's convenient to just use kivy's clock. You can do something like the following.

                  from kivy.clock import Clock
                  
                  class app(App):
                      def build(self):
                          self.layout = Layout()
                          self.name = Label(text = "john")
                          self.layout.add_widget(self.name)
                          self.current_i = 0
                          Clock.schedule_interval(self.update, 1)
                          return self.layout
                  
                      def update(self, *args):
                          self.name.text = str(self.current_i)
                          self.current_i += 1
                          if self.current_i >= 50:
                              Clock.unschedule(self.update)
                  

                  這篇關于運行代碼時更新 kivy 小部件的屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)
                • <i id='6nQ3L'><tr id='6nQ3L'><dt id='6nQ3L'><q id='6nQ3L'><span id='6nQ3L'><b id='6nQ3L'><form id='6nQ3L'><ins id='6nQ3L'></ins><ul id='6nQ3L'></ul><sub id='6nQ3L'></sub></form><legend id='6nQ3L'></legend><bdo id='6nQ3L'><pre id='6nQ3L'><center id='6nQ3L'></center></pre></bdo></b><th id='6nQ3L'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6nQ3L'><tfoot id='6nQ3L'></tfoot><dl id='6nQ3L'><fieldset id='6nQ3L'></fieldset></dl></div>

                  <small id='6nQ3L'></small><noframes id='6nQ3L'>

                    <tfoot id='6nQ3L'></tfoot>
                        <tbody id='6nQ3L'></tbody>
                      • <bdo id='6nQ3L'></bdo><ul id='6nQ3L'></ul>

                          • <legend id='6nQ3L'><style id='6nQ3L'><dir id='6nQ3L'><q id='6nQ3L'></q></dir></style></legend>

                            主站蜘蛛池模板: 久久草在线视频 | 亚洲一区二区在线 | 精品久久一区 | 一区二区三区亚洲精品国 | 毛色毛片免费看 | 凹凸日日摸日日碰夜夜 | 91视频在线看 | 午夜三级网站 | 亚洲a在线观看 | 97人人超碰 | 国产激情视频在线观看 | 亚洲成人毛片 | 精品国产一区二区三区日日嗨 | 一区二区在线免费观看 | 亚洲一区二区久久 | 国产一区二区三区不卡av | 91资源在线播放 | 丝袜美腿一区二区三区动态图 | 午夜影院在线免费观看视频 | 中文一区二区 | 九九视频在线观看视频6 | 亚洲精品一 | 日韩一区二区三区视频在线播放 | 999热视频| 免费亚洲视频 | 成人午夜视频在线观看 | 一区二区日本 | 伊人婷婷 | 日韩欧美高清 | 福利网址 | 久久国产精品首页 | 黄一区二区三区 | 久久99精品久久久久久秒播九色 | 日批免费在线观看 | www.97zyz.com| 岛国av免费观看 | 中文二区 | 九九综合九九 | 久草在线中文888 | 国产精品久久久久久久久久99 | 久久精品网 |