Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as Tk
- from PIL import Image,ImageTk
- def anim():
- global img,photo1,image,x
- if img==8:
- img=0
- else:
- img+=1
- if x>=fen1.winfo_screenwidth():
- x=0
- else:
- x=x+5
- can1.delete(image)
- image=Image.open('marche'+str(img)+'.gif')
- photo1=ImageTk.PhotoImage(image)
- can1.create_image(x,0,anchor=Tk.N,image=photo1)
- fen1.after(50,anim)
- fen1=Tk.Tk()
- wFen=fen1.winfo_screenwidth()
- hFen=fen1.winfo_screenheight()
- dimFen=str(wFen)+'x'+str(int(hFen/2))+'+0+0'
- fen1.geometry(dimFen)
- fen1.configure(bg='green')
- pause=False
- img=0
- x=0
- image=Image.open('marche0.gif')
- photo1=ImageTk.PhotoImage(image)
- can1=Tk.Canvas(fen1,width=wFen,height=image.size[1],bg='white')
- can1.create_image(x,0,anchor=Tk.N,image=photo1)
- can1.pack(padx=10,pady=10)
- Bou1=Tk.Button(fen1,text='Quit',command=fen1.destroy)
- Bou1.pack(side=Tk.BOTTOM)
- Bou2=Tk.Button(fen1,text='Pause',command=fen1.destroy)
- Bou2.pack(side=Tk.BOTTOM)
- if pause == False:
- anim()
- elif pause == True:
- anim()
- fen1.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement