How to terminate a TkinterApp correctly?
glingl at aon.at
Sat Aug 16 21:42:08 CEST 2003
Michael Peuser schrieb:
> ----- Original Message -----
> From: "Gregor Lingl" <glingl at aon.at>
> Newsgroups: comp.lang.python
> 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:
>> 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!?
> def exit(self):
Here I apparently don't understand something fundamental:
What is the effect of a return statement as the last statement
of a function?
When I put this exit into the cv.master.protocol call as shown below,
I cannot close the application at all. (I think it's clear to me why)
> (If you can put it into an appropriate class ....)
>>if not usingIDLE:
More information about the Python-list