【发布时间】:2018-04-27 06:31:48
【问题描述】:
我正在尝试在动画完成后删除 Image 小部件。
到目前为止,我已经设法为小部件设置动画,然后在动画结束后调用animation_complete 方法。不幸的是,小部件没有被删除。
我做错了什么?
class ShootButton(Widget):
def bullet_fly(self):
def animation_complete(animation, widget):
print "removing animation"
self.remove_widget(widget=bullet1)
with self.canvas:
bullet1 = Image(source='bullet.png', pos = (100,200))
animation1 = Animation(pos=(200, 300))
animation1.start(bullet1)
animation1.bind(on_complete=animation_complete)
【问题讨论】: