<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:verdana, helvetica, sans-serif;font-size:10pt"><div>Hi!</div><div><br></div><div>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?</div><div>Help would be greatly appreciated. Thank you.</div><div><br></div><div><div><div>#Working on window interface of soundAsleep</div><div><br></div><div>#Tkinter will handle the GUI</div><div>from Tkinter import *</div><div>import time</div><div><br></div><div>root = Tk()</div><div>root.title("soundAsleep beta")</div><div><br></div><div>frame=[]</div><div>currentframe=0</div><div><br></div><div>#Importing the images. They are named w1.gif, w2.gif...w7.gif</div><div>for i in
 range(1,7):</div><div>&nbsp;&nbsp; &nbsp;fname="core/working/w"+str(i)+".gif"</div><div>&nbsp;&nbsp; &nbsp;frame+=[PhotoImage(file=fname)]</div><div><br></div><div>wrap = Canvas(root, width=200, height=120)</div><div>wrap.pack()</div><div><br></div><div>#trying to make the animation</div><div>while True:</div><div>&nbsp;&nbsp; &nbsp;ani=wrap.create_image(100,70,image=frame[currentframe])</div><div>&nbsp;&nbsp; &nbsp;time.sleep(5)</div><div>&nbsp;&nbsp; &nbsp;wrap.update_idletasks() #Force redraw</div><div>&nbsp;&nbsp; &nbsp;wrap.delete(ani)</div><div>&nbsp;&nbsp; &nbsp;if (currentframe==5):</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;currentframe=0</div><div>&nbsp;&nbsp; &nbsp;else:</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;currentframe+=1</div><div>&nbsp;&nbsp; &nbsp;</div><div>root.mainloop()</div><div><br></div></div></div><div style="position:fixed"></div>


<!-- cg24.c2.mail.ac4.yahoo.com compressed/chunked Sun Dec 20 10:19:22 PST 2009 -->
</div><br>

      </body></html>