Answers for "pysimplegui animated gif"

0

pysimplegui animated gif

from PIL import Image, ImageTk, ImageSequence
import PySimpleGUI as sg

gif_filename = r'ExampleGIF.gif'

layout = [[ 
    [sg.Image(filename=gif_filename,
              enable_events=True,
              key="-IMAGE-")]
]]

window = sg.Window('Window Title', layout, finalize=True) #finalize is important!

while True:
    for frame in ImageSequence.Iterator(Image.open(gif_filename)):
        event, values = window.read(timeout=100)
        window['-IMAGE-'].update(data=ImageTk.PhotoImage(frame) )
Posted by: Guest on April-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language