[Tutor] TKinter and IDLE problem
Dick Moores
rdm@rcblue.com
Tue Dec 10 05:17:01 2002
That works. Thanks!
Dick Moores
rdm@rcblue.com
At 10:21 12/10/2002 +0100, you wrote:
>
>AFIS, this is a well known problem when using
>IDLE with Tkinter. IT has it's origin in the fact,
>that IDLE itself is a Tkinter-App, so there is
>already an active mainloop there.
>
>Solution: if you use or develop TKinter-programs
>with IDLE, comment out (or delete) the
>root.mainloop() statement.
>
>However, if you want to run your app without
>IDLE you have to uncomment or insert it again.
>
>A nice idiom, to accomplish this is as follows below:
>
>
>Dick Moores schrieb:
>
>>
>>
>> What am I doing wrong?
>>
>> Thanks,
>>
>> Dick Moores
>> rdm@rcblue.com
>>
>> ========================
>> # File: hello1.py
>>
>> from Tkinter import *
>
> usingIDLE = 1 # True
>
> # code of your app
>
>>
>> root = Tk()
>>
>> w = Label(root, text="Hello, world!")
>> w.pack()
>
> if not usingIDLE:
> root.mainloop()
>
># you turn mainloop on by setting
># usingIDLE = 0