【发布时间】:2017-03-22 14:47:07
【问题描述】:
点击按钮后,应用程序应该显示一个很重的表格,所以我想先显示一个动画gif,然后再显示表格。
当按钮被点击时,第一个 def 被调用:
wait_image= Loading()
self.add_widget(wait_image)
Clock.schedule_once(lambda x: self.DisplayTable(self), 0)
但这只会加载动画gif 的第一帧。如果我将 Clock.schedule 替换为 return self,则动画 gif 有效,但不会调用 DisplayTable def:
wait_image= Loading()
self.add_widget(wait_image)
return self
我尝试调用另一个将返回 self 的 def,然后继续使用 DisplayTable 但这也不起作用(.gif 没有动画但显示了表格):
Loading_image(self)
Clock.schedule_once(lambda x: self.DisplayTable(self), 0)
与:
def Loading_image(self):
wait_image= Loading()
self.add_widget(wait_image)
return self
那么我怎样才能通过简单的点击,调用并显示一个动画 gif,然后继续调用 DisplayTable def?
这是Builder 和Loading 类:
Builder.load_string('''
<Loading>
source : 'loading.zip'
anim_delay : 0.02
allow_stretch : True
keep_ratio : True
keep_data : True
''')
class Loading(AsyncImage):
pass
代码是here
【问题讨论】:
标签: python kivy animated-gif