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

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

    <i id='eZrVG'><tr id='eZrVG'><dt id='eZrVG'><q id='eZrVG'><span id='eZrVG'><b id='eZrVG'><form id='eZrVG'><ins id='eZrVG'></ins><ul id='eZrVG'></ul><sub id='eZrVG'></sub></form><legend id='eZrVG'></legend><bdo id='eZrVG'><pre id='eZrVG'><center id='eZrVG'></center></pre></bdo></b><th id='eZrVG'></th></span></q></dt></tr></i><div id='eZrVG'><tfoot id='eZrVG'></tfoot><dl id='eZrVG'><fieldset id='eZrVG'></fieldset></dl></div>
    <tfoot id='eZrVG'></tfoot>
      <legend id='eZrVG'><style id='eZrVG'><dir id='eZrVG'><q id='eZrVG'></q></dir></style></legend>
    1. Kivy:如何在等待显示另一个小部件时显示一个小部

      时间:2023-10-10
      1. <small id='4fvPN'></small><noframes id='4fvPN'>

        • <bdo id='4fvPN'></bdo><ul id='4fvPN'></ul>

          <legend id='4fvPN'><style id='4fvPN'><dir id='4fvPN'><q id='4fvPN'></q></dir></style></legend>
            <i id='4fvPN'><tr id='4fvPN'><dt id='4fvPN'><q id='4fvPN'><span id='4fvPN'><b id='4fvPN'><form id='4fvPN'><ins id='4fvPN'></ins><ul id='4fvPN'></ul><sub id='4fvPN'></sub></form><legend id='4fvPN'></legend><bdo id='4fvPN'><pre id='4fvPN'><center id='4fvPN'></center></pre></bdo></b><th id='4fvPN'></th></span></q></dt></tr></i><div id='4fvPN'><tfoot id='4fvPN'></tfoot><dl id='4fvPN'><fieldset id='4fvPN'></fieldset></dl></div>
              <tfoot id='4fvPN'></tfoot>

                  <tbody id='4fvPN'></tbody>
              1. 本文介绍了Kivy:如何在等待显示另一个小部件时显示一个小部件(都从同一个事件调用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                单击确定按钮"时,我的 kivy 应用程序检索有时包含 100 多个文件夹的列表,并显示每个文件夹 4 列和 1 行的 GridLayout.每行有 3 个可滚动标签和 1 个复选框.这个 GridLayout 有时需要将近 12 秒才能生成,所以我想同时显示一些东西(标签、图像......).

                When an "OK button" is clicking, my kivy app retrieves a list of sometimes 100+ folders and displays a GridLayout with 4 columns and 1 row per folder. Each row has 3 scrollable labels and 1 checkbox. This GridLayout sometimes takes close to 12 sec to be generated so I would like to display something (a label, an image...) in the meantime.

                尝试 1: 我的确定按钮"调用 def DisplayTable.我试图简单地在 DisplayTable 的开头添加 self.add_widget(Label_when_waiting) (所以在任何处理或生成 GridLayout 之前)但 Label_when_waiting 仅在 GridLayout 时显示显示.

                Attempt 1: My "Ok button" calls a def DisplayTable. I tried to simply add self.add_widget(Label_when_waiting) right at the beginning of DisplayTable (so before any processing or generating the GridLayout) but the Label_when_waiting is displayed only when GridLayout is displayed.

                尝试2:我试图将def DisplayTable分成两个def,Diplay_Label_when_waiting(由确定按钮"调用的那个)和DisplayTable:

                Attempt 2: I tried to separate def DisplayTable into two def, Diplay_Label_when_waiting(the one called by the "OK button") and DisplayTable:

                def Diplay_Label_when_waiting(self, *args):
                    self.add_widget(Label_when_waiting)
                    DisplayTable(self, *args)
                

                但这里又是 Label_when_waiting 仅在显示 GridLayout 时才显示.

                But here again, Label_when_waiting is displayed only when GridLayout is displayed.

                那么我如何在 GridLayout 之前显示 Label_when_waiting 知道两个显示都必须由确定按钮"触发

                So how can I display Label_when_waiting before GridLayout knowing that both displays have to be triggered by the "Ok button"

                推荐答案

                使用Clock.schedule_once在标签显示后显示Grid:

                Use Clock.schedule_once to display the Grid after the label is shown:

                def Diplay_Label_when_waiting(self, *args):
                    self.add_widget(Label_when_waiting)
                    Clock.schedule_once(lambda dt: DisplayTable(self, *args), 0)
                

                您也可以使用 kivyoav 中的 delayable(免责声明 - 我是作者...)

                You can also use delayable from kivyoav (DISCLAIMER - I'm the author ...)

                from kivyoav.delayed import delayable
                
                @delayable
                def Diplay_Label_when_waiting(self, *args):
                    self.add_widget(Label_when_waiting)
                    yield 0.0 # delay of 0ms , will cause the UI to update...
                    DisplayTable(self, *args)
                

                这篇关于Kivy:如何在等待显示另一个小部件时显示一个小部件(都从同一个事件调用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何获取 kivy 按钮的 Id 和 Text 值作为字符串? 下一篇:Kivy:如何将复选框设置为在启动时选中

                相关文章

                最新文章

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

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

                    <bdo id='SMVru'></bdo><ul id='SMVru'></ul>
                  <tfoot id='SMVru'></tfoot>
                3. <small id='SMVru'></small><noframes id='SMVru'>