[Tutor] Re: Re: Re: Tkinter and Animation

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Thu Apr 28 05:00:55 CEST 2005


Quoting Jeremiah Rushton <jeremiah.rushton at gmail.com>:

> from Tkinter import *
> from time import sleep
> 
> class Main:
> 
>  def __init__(self,master):
>   button = Button(master,text='button')
>   button.place(x=1,y=1)
>   y=3
>   for x in range(1,25):
>    sleep(.3)
>    button.place_forget()
>    button.place(x=1,y=y)
>    y +=2
> 
> 
> root = Tk()
> Main(root)
> root.title('test')
> root.mainloop()

Try adding a call to master.update_idletasks() in your for loop.  Still not
ideal, though, but maybe it would work better if you were doing the animation
after the Tk mainloop had started. (I'm just guessing there, though)

-- 
John.


More information about the Tutor mailing list