Mundo em Python

Mudar a imagem (mover de forma automática)

from tkinter import *

from PIL import Image,ImageTk
t=Tk()
t.geometry("250x125")
t.title("Ligar a Luz")
img1=ImageTk.PhotoImage(Image.open("0.png"))
img2=ImageTk.PhotoImage(Image.open("1.png"))
l=Label(t,font="bold")
l.pack()
x=1
def move():
global x
if x==4:
x=1
if x==1:
l.config(image=img1)
elif x==2:
l.config(image=img2)
x+=1
t.after(2000,move)
move()
t.mainloop()

0.png


0.png


1.png


1.png

0