我需要更新一组标签,一次一个,但是我还需要在函数完成之前查看更改的效果。期望的结果是一种加载杆。在
现在,我的代码在函数的末尾一次应用所有更改。在
(代码简化以便于阅读)
在主.py在
def TextAnimation(self):
#self.ids.??? are labels
self.ids.x1y1.text = "-"
self.ids.x2y1.text = "-"
self.ids.x3y1.text = "-"
self.ids.x1y1.texture_update()
self.ids.x2y1.texture_update()
self.ids.x3y1.texture_update()
time.sleep(0.2)
self.ids.x4y1.text = "-"
self.ids.x5y1.text = "-"
self.ids.x6y1.text = "-"
self.ids.x4y1.texture_update()
self.ids.x5y1.texture_update()
self.ids.x6y1.texture_update()
time.sleep(0.2)
我的印象是labelName.texture_update()
立即调用下一帧,而不是等待函数结束,但似乎并不像文档中描述的那样工作
Warning
The texture update is scheduled for the next frame. If you need the texture immediately after changing a property, you have to call the texture_update() method before accessing texture:
您应该使用Clock来安排标签文本的更改。考虑以下代码:
在试验电压公司名称:
在主.py公司名称:
^{pr2}$相关问题 更多 >
编程相关推荐