Skip to content Skip to sidebar Skip to footer

Kivy: How To Display A Widget While Waiting For Another One To Be Displayed (both Called From A Same Event)

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 lab

Solution 1:

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)

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)

Post a Comment for "Kivy: How To Display A Widget While Waiting For Another One To Be Displayed (both Called From A Same Event)"