Search code examples
pythonpython-3.xkivygifkivy-language

White background when try to play GIF in Kivy


import kivy
from kivy.clock import Clock
from functools import partial
import main as m
kivy.require("1.10.0")
from kivy.lang.builder import Builder
from kivy.app import App
from kivy.uix.image import Image
from kivy.uix.anchorlayout import AnchorLayout
from kivy.core.window import Window
from kivy.uix.popup import Popup
from kivy.core.window import Window
Show_Func = Window.show
Window.size = (300, 100)
Window.borderless = True
Window.left = 1620
Window.top = 140
x = Builder.load_string("""
<GIF>:
    Image:
        id: img_gif
        source: '1.gif'
        anim_loop: 0
""")
class SampleApp(App):
    def build(self):
        return x
Clock.schedule_once(partial(m.Running_in_background, Show_Func),0.1)
if __name__ == '__main__':
    SampleApp().run()

When window shows it fully white and then after 10~ seconds it begin to not response. I cannot find the answer in google. Thanks for help)


Solution

  • Since a .gif file takes much time to load you should first extract each frame of the .gif into a folder and make it a .zip file, you can archieve this by using gimp and adding an extension, you can download the extension from here http://registry.gimp.org/node/28268. Then load the .zip file like this

    Image:
       source: 'my.zip'