pysimplegui animated gif

Solutions on MaxInterview for pysimplegui animated gif by the best coders in the world

showing results for - "pysimplegui animated gif"
Rodrigo
27 Aug 2017
1from PIL import Image, ImageTk, ImageSequence
2import PySimpleGUI as sg
3
4gif_filename = r'ExampleGIF.gif'
5
6layout = [[ 
7    [sg.Image(filename=gif_filename,
8              enable_events=True,
9              key="-IMAGE-")]
10]]
11
12window = sg.Window('Window Title', layout, finalize=True) #finalize is important!
13
14while True:
15    for frame in ImageSequence.Iterator(Image.open(gif_filename)):
16        event, values = window.read(timeout=100)
17        window['-IMAGE-'].update(data=ImageTk.PhotoImage(frame) )