Search code examples
pythonkivyurlrequest

Kivy - How to update label from Urlrequest on_progress / screen refresh


My screens contain a message field which I want to update through the on_progress callback when invoking heavy duty rest calls.

def restprogress(self, current_size, total_size):
    screen = App.get_running_app().current_screen
    print('Loading')
    screen.ids.messagefield.text = 'Loading .'

Callback works fine and message is printed. The label text only changes though, if I abort the Urlrequest (to avoid the success message being displayed).

How can I force the screen update before the rest call completes? Thanks, Martin


Solution

  • Thanks John Anderson, running the update of the label text from the main thread solved the issue. I achieved this by invoking an update through the Clock.schedule_once() call.