Shall we declare Tkinter dead? No-one seems interested in it ;o)

jepler epler jepler.lnk at lnk.ispi.net
Mon Oct 30 07:38:48 EST 2000


All the code below is untested, but I'm familiar with the techniques
from pure tcl/tk programming.

You can have a piece of code be called when the window-manager "close"
function is invoked:
	blah = Toplevel(...)
	blah.wm_protocol("delete", func)
func might set a global variable, raise an exception, or manipulate a
semaphore.

You could also use the wait_window method:
	blah = Toplevel(...)
	blah.wait_window()
wait_window essentially executes the tk mainloop (potentially recursively)
until the window is destroyed.

Finally, you could use the wait_variable method:
	blah = Toplevel(...)
	var  = Variable()
	blah.wait_variable(var)
arrange to set var to a new value when the window is closed.

Whether these work properly in the presence of "microthreads", I admit I'm
unsure.

On Sun, 29 Oct 2000 21:42:59 -0500, Mike Fletcher
 <mfletch at tpresence.com> wrote:
>Side note: are all the mouse interactions under Tkinter atomic C functions?
>For instance, dragging or resizing the window stops all other micro-threads
>until the drag/resize stops.

This may depend on the platform where you use tk, and when under X11
on the details of your window manager.  I use X11 and a window manager
called "icewm".  When I enable "solid" moves/resizes, a tkinter app is
able to respond during the operation.

Jeff
PS if we had to jettison tkinter in favor of some other gui, I wish that
someone would set up gtk+pygtk+glade for me to run on win32.  I looked
at wxpython once, but it was all greek to me, and I couldn't get it to
run under X11 at all, just win32.  The point being, I think it's probably
largely a religious argument.  Tkinter works, and it gets installed by
default everywhere, and I'd be the first to admit the pragmatism of
"doing in Rome as the Romans do."



More information about the Python-list mailing list