How to terminate a TkinterApp correctly?
mpeuser at web.de
Sat Aug 16 18:35:13 CEST 2003
----- Original Message -----
From: "Gregor Lingl" <glingl at aon.at>
Sent: Saturday, August 16, 2003 3:53 PM
Subject: Re: How to terminate a TkinterApp correctly?
> Thanks for your remarks and your example. The
> following solution finally did it:
> def exit():
> global done
> done = True # so the animation will terminate, but
> # not immediately! The actual pass through
> # the loop has to be finished.
> print "done!"
> import sys
> # after_idle seems to be crucial! Waits for terminating
> # the loop (which is in a callback function)
> cv.after_idle(sys.exit, (0,))
Why don't you just return? The mainloop can handle everything!?
(If you can put it into an appropriate class ....)
> cv.master.protocol("WM_DELETE_WINDOW", exit)
> if not usingIDLE:
> Regards, Gregor
More information about the Python-list