Tk mainloop()

dan danbmil99 at yahoo.com
Sun Jul 20 10:26:53 EDT 2003


I asked this question yesterday (see prev. thread about calling TCL
from Py & V.V) -- the solution I came up with from responses & looking
at some old posts:

instead of foobar.mainloop(), do this:
 
while quitflag==0    #set this to 1 somewhere to quit
  yourcodehere()     #whatever needs to be done
  foobar.update()    #equivalent to TCL_DoOneCall()?or try
_Tkinter.doonecall()
  time.sleep(0.01)   #allow the Tkinter thread to run

Only problem I'm having right now is occasional crash on breakdown but
I think I just have to give Tk more time to close up shop.

-dbm

"Petr Evstratov" <tetra701 at mail.ru> wrote in message news:<mailman.1058675670.11192.python-list at python.org>...
> Hi, I have a question: how do you execute an arbitrary function in Tk fooBar.mainloop()?
> 
> I need to change the contents of a label every second, but I think I will also use some other functions as well...
> 
> I hope that someone will answer my question, because I have been looking for an answer for 3 days, asking people, searching Google... and still have not found anything useful...
>       
>                                    Thanks, Pete




More information about the Python-list mailing list