Run an gif animation only once on kivy

641 views Asked by At

I wanted to make an kivy app which runs an gif animation.

The gif animation is supposed to be stopped after it runs once on the application start, but the gif animation is running over and over again and I don't know how to stop it.

Here is the code(the part which is important):

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

''')
1

There are 1 answers

1
Nykakin On

You should set anim_loop property:

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.