Python Kivy-如何在进度/屏幕刷新时从URL请求更新标签

Python Kivy-如何在进度/屏幕刷新时从URL请求更新标签,python,kivy,urlrequest,Python,Kivy,Urlrequest,我的屏幕包含一个消息字段,在调用重载rest调用时,我希望通过on_progress回调更新该字段 def restprogress(self, current_size, total_size): screen = App.get_running_app().current_screen print('Loading') screen.ids.messagefield.text = 'Loading .' 回调工作正常,消息已打印。但是,如果我中止URL请求(以避免显

我的屏幕包含一个消息字段,在调用重载rest调用时,我希望通过on_progress回调更新该字段

def restprogress(self, current_size, total_size):
    screen = App.get_running_app().current_screen
    print('Loading')
    screen.ids.messagefield.text = 'Loading .'
回调工作正常,消息已打印。但是,如果我中止URL请求(以避免显示成功消息),则标签文本只会更改

如何在rest调用完成之前强制屏幕更新? 谢谢 马丁

谢谢, 从主线程运行标签文本的更新解决了这个问题。我通过调用Clock.schedule_once()调用来实现这一点。

谢谢,
从主线程运行标签文本的更新解决了这个问题。我通过调用Clock.schedule_once()调用调用更新来实现这一点。

发布一个最小的可运行示例。
screen.ids.messagefield.text='Loading'。
必须在主线程上运行。也许可以使用
Clock.schedule\u once()
来完成这一点。发布一个最小的可运行示例。必须在主线程上运行
screen.ids.messagefield.text='Loading'。
。也许可以使用
Clock.schedule\u once()
来完成这一点。