Tkinter and Win 95

Mike Clarkson support at internetdiscovery.com
Sun Jun 10 14:05:32 EDT 2001


On Wed, 6 Jun 2001 11:36:34 +0100, Robin Becker
<robin at jessikat.fsnet.co.uk> wrote:

>I'm running Python 2.1 with Win32 and am using Pmw as a framework for
>building an App. I'm having problems when killing the app using the
>window manager. In particular under win95 although the application
>window disappears I sometimes get a hanging python process. This process
>can be killed using the standard techniques, but it leaves something
>behind that effectively prevents Win95 from shutting down completely.
>Something that is intensely annoying as it prevents clean autobooting
>etc.

There are a couple of different ways by which this come about, some
Tk, some Tkinter. The most likely is because Tkinter is withdrawing
and not using the "." window, the other toplevel windows are being
destroyed and "." is still keeping the application alive.

Do you have a copy of (pure Tk) tkinspect around, or any wish
where you can do a [winfo interps] and [send $interp wm deiconify .]
to see if "." is still around and the intepreter is responding. Is the
"hung" process consuming any CPU?

>I am using the traditional trick of handling the wm event as
>
>                .....
>                self.root.wm_protocol("WM_DELETE_WINDOW",self.quit)
>         .......
>        def quit(self):
>                self.root.destroy()
>
>but how can I get this to work cleanly on Win95?

As I recall, that traditional trick is a traditional pitfall under
some circumstances. In self.quit  you should explicitly do a 

                self.root.wm_protocol("WM_DELETE_WINDOW", None)

before calling the destroy, otherwise you can get an infinite loop.

BTW, which version of Tk, which version of Tkinter, and what O/S?
Mike.



More information about the Python-list mailing list