Hi!
I'm trying to make an animation using a sequence of gif images and the canvas
widget, but all I see when I compile is a black screen. What I'm trying to do
is delete the previous image and create the next one each frame. Am I doing it
wrong? Is it do-able at all?
Help would be greatly appreciated. Thank you.
#Working on window interface of soundAsleep
#Tkinter will handle the GUI
from Tkinter import *
import time
root = Tk()
root.title("soundAsleep beta")
frame=[]
currentframe=0
#Importing the images. They are named w1.gif, w2.gif...w7.gif
for i in range(1,7):
fname="core/working/w"+str(i)+".gif"
frame+=[PhotoImage(file=fname)]
wrap = Canvas(root, width=200, height=120)
wrap.pack()
#trying to make the animation
while True:
ani=wrap.create_image(100,70,image=frame[currentframe])
time.sleep(5)
wrap.update_idletasks() #Force redraw
wrap.delete(ani)
if (currentframe==5):
currentframe=0
else:
currentframe+=1
root.mainloop()
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss