[Pythonmac-SIG] Using Tkinter with 2.1.1

Martin Miller mmiller@adobe.com
Fri, 07 Dec 2001 14:11:52 -0800


Hello, I am a Python/PythonMac newbie and have encountered a problem
re-running scripts in the Python IDE that use the Tkinter module. They
will work the first time I click the "run all" button (assuming there
were no programming mistakes made ;-) but not the second time I do it.
Instead I get the following error message:

> Menu ID 256 is already in use!Fatal Python error: Tcl/Tk panic

and the IDE locks up. All I can do at that point is option-cmd-esc and
click the "Force Quit" button.

Here's a script that exhibits the problem:

> import Tkinter
> widget = Tkinter.Label(None, text="Hello World!")
> widget.pack()
> widget.mainloop()

I tried adding a "del Tkinter" statement at the end but that did not
help the problem.

Is there something I must do to allow such a script to be rerun without
Quitting, restarting the IDE, and then reopening the script?

Thanks in advance.

Martin