Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as Tk
- from PIL import Image,ImageTk
- def animation():
- global i,x
- if go==True:
- img=Image.open("marche"+str(i)+".gif")
- photo=ImageTk.PhotoImage(img)
- can1.create_image(x,0,anchor=Tk.NW,image=photo)
- can1.photo=photo
- can1.pack
- fen1.after(80,animation)
- x=x+40
- i=i+1
- if i>8: i=1
- if x>1366: x=0
- return()
- def pause():
- global go
- go=not go
- if go==True:
- animation()
- #Programme principal
- fen1=Tk.Tk()
- largeur=fen1.winfo_screenwidth()
- longueur=fen1.winfo_screenheight()
- taille=str(largeur)+"x"+str(longueur)+"+0+0"
- fen1.geometry(taille)
- fen1.configure(bg="green")
- can1=Tk.Canvas(fen1,width=int(largeur-35),height=300,bg="white")
- can1.grid(padx=10,pady=10)
- go=True
- x=0
- i=1
- animer=animation()
- stop=Tk.Button(fen1,text="Pause",bg="white",fg="black", command=pause)
- stop.place(x=(largeur//2)-10,y=400)
- destroy=Tk.Button(fen1,text="Quitter",bg="white",fg="red", command=fen1.destroy)
- destroy.place(x=(largeur//2)-10,y=450)
- fen1.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement