[Tkinter-discuss] Main loop / Scheduling
asolway at seas.upenn.edu
Thu Apr 10 17:45:40 CEST 2008
I'm debugging an existing application which uses Tkinter. Having not
worked much with the library... please bear with me. In general, how
is invocation of the event handler/dispatcher scheduled?
The application in question is a Tcl/Tk library written in C; a Python
interface using Tkinter sits on top of it. It seems to start the main
loop implicitly by creating a Tkinter.Tk object (is this true of how
the loop gets started?). The underlying C library schedules a task to
run at a set interval with Tcl_CreateTimerHandler(...). If I'm not
running any code outside of this framework, all is good. However, if I
run anything in Python-space (say, just a really long loop that prints
numbers, for testing), invocation of the scheduled task is delayed
until this other task is done. My questions then are:
(1) Is this an inherit problem with how things in general are set up?
Is everything running under a single thread?
(2) If not, is it possible to bump up the priority of the Tcl/Tk main
loop and have it preempt Python space more often (or at all!), or
conversely, downgrade the priority of the Python space process?
(3) If option 2 fails, are there other alternatives anyone can think
of to have these two things co-operate?
Thanks for your help.
More information about the Tkinter-discuss