[Tkinter-discuss] animated gif

Cameron Laird Cameron at phaseit.net
Thu Jun 15 20:48:11 CEST 2006


On Thu, Jun 15, 2006 at 08:28:25PM +0200, Pavel Kosina wrote:
			.
			.
			.
> How to animate an animated gif? I made some trials, using metod seek() 
> on instance of Image.open, cause I believe Tkinter can not do this 
> itself, but no success. My gif got 2 frames, and the second one is 
> always more or less black.
> 
> This script is not "animated", just want to show my approach to the problem:
> 
> from Tkinter import *
> from PIL import Image, ImageTk
> 
> hlavni=Tk()
> platno=Canvas(hlavni)
> platno.pack()
> 
> image = Image.open("myani.gif")
> frames=[]
> for frame in range(2):
>     image.seek(frame)
>     frames.append(ImageTk.PhotoImage(image))
> 
> platno.create_image(50,50, image=frames[0])
> platno.create_image(100,100, image=frames[1])
> 
> hlavni.mainloop()
			.
			.
			.
1.  I wrote a gif animator for Tk:  <URL: http://wiki.tcl.tk/anigif >.
2.  While I'm busy today, maybe on the weekend I'll adapt it to
    Tkinter and comment on what you've written.



More information about the Tkinter-discuss mailing list