idle BUG

Mike Clarkson support at internetdiscovery.com
Mon Jun 18 16:28:26 EDT 2001


On Thu, 14 Jun 2001 20:22:08 +0100, Robin Becker
<robin at jessikat.fsnet.co.uk> wrote:

>I think this must be a bug in Tkinter, but since no one ever responds I
>thought I'd whine about idle instead. 
>
>I run python2.1 Win95 OSR2.
>Start a command window
>run python idle.py
>
>Kill the idle window using the mouse (click on the x). In some unknown
>percentage of cases (like 50%) the process hangs and doesn't return to
>the command window.

Robin, try this (you'll have to fix the tk.eval lines back up to be
all one line). In Tkinter.py, change quit() to

    def quit(self):
        """Quit the Tcl interpreter. All widgets will be destroyed."""
        self.tk.eval('foreach w [winfo child .] {wm protocol $w
WM_DELETE_WINDOW {}; catch {destroy $w}}')
        self.tk.eval('catch {set w .; wm protocol $w WM_DELETE_WINDOW
{}; destroy $w}')
        self.tk.quit()

If it works for you, I'll explain why it's required under Tkinter, but
not Tk.

This makes self.quit() do what it's documented to do, and leaves 
self.tk.quit (which is _tkinter.quit) to do what it does now, namely
signals the mainloop to end but destroys no widgets.

>The hung process is very destructive and makes it impossible to reboot
>the machine properly. This bug has been present for a very long time and
>I'm fed up with it.

It's a nasty bug, and this seems to fix it. It causes a harmless error
exiting idle that I'll look at (I think a a winfo_exists() check needs
adding in Tkinter.unbind as bullet-proofing).

Mike.



More information about the Python-list mailing list