繁体   English   中英

在kivy上仅运行一次gif动画

[英]Run an gif animation only once on kivy

我想制作一个运行gif animationkivy app

gif animation应该在application启动后运行一次之后停止,但是gif animation又一次又一次地运行,我不知道如何停止它。

这是代码(重要的部分):

class level(BoxLayout):
    pass


class Feld(Widget):
    weg = StringProperty('test.gif')
    def on_touch_down(self, touch):
        if self.ids.my_image.collide_point(*touch.pos):
            pass

Root = Builder.load_string('''
level:
    id: level
<level>:
    orientation: 'vertical'
    BoxLayout:
        id: box1
        orientation: 'horizontal'
        Feld:
            pos: 100, 310
            id: a1
<Feld>:
    Image:
        pos: root.pos
        id: my_image
        source: root.weg

''')

您应该设置anim_loop属性:

anim_loop                                                Added in 1.9.0

    Number of loops to play then stop animating. 0 means keep animating.

    anim_loop is a NumericProperty defaults to 0.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM