Exiting Tkinter when using IDLE

Eugene Van den Bulke eugene at boardkulture.com
Fri Mar 12 21:00:01 CET 2004


On Fri, 12 Mar 2004 08:14:24 +0100, Gerrit Muller 
<gerrit.muller at embeddedsystems.nl> wrote:

> Jason Harper wrote:
>
>> You have two issues here:
>>
>> 1. Don't use the quit method, instead just close your window.  Your QUIT
>> button could perhaps use:
>> 	command=self.destroy
>>
>> 2. Don't call mainloop() if IDLE already has one running.  Try this:
>>
>> import sys
>> if "idlelib" not in sys.modules:
>> 	root.mainloop()
>>
>> 	Jason Harper
>
> I think that this answer deserves a place in a cookbook recipe. I did 
> not work with Tkinter for more than a year, but I remember that I 
> struggled with exactly the same issues and more or less experimentally 
> reached this solution.
>
> thanks for the clarification!
>
> regards Gerrit
>

I have a probleme with the "if idlelib" solution ... without the 
root.mainloop() the window does not appear after I pressed F5 to run the 
programm. But when I type root.mainloop() in the shell window that opens 
up, it works.

Any idea? Thanks for your help.


-- 
Eugene Van den Bulke
[-----
www.boardkulture.com
www.actiphot.com
www.xsbar.com
-----]



More information about the Python-list mailing list