Cause:
1. create a Tk window
2. call Tkinter.mainloop()
3. close the Tk window created in (1)
Result:
1. IDLE doesn't return to a Python prompt.
2. IDLE won't close, unless you kill it from
the task manager.
Code sample:
>>> import Tkinter
>>> Tkinter.tk()
>>> Tkinter.mainloop()
Presumably, this happens because IDLE is using Tk
itself, and is not isolating the Python interactive
shell from itself well enough. It's possible that
solving this problem would require changes to kinter?
But at the very least, it should be ocumented. A
workaround (posted by stefan kusch) is to use the
following test to see if you're running in IDLE with:
_inidle = type(sys.stdin) == types.InstanceType and \
sys.stdin.__class__.__name__ == 'PyShell'
and not call mainloop() if you're in IDLE.
But, of course, a real fix is preferable to a
workaround :)
A web search turned up several mentions of this, but I
didn't see a bug report for it, so I figured I'd
submit one.
|