[Tkinter-discuss] Redefine quit menu item on Mac to quit from a Twisted/Tkinter application?

Russell E. Owen rowen at u.washington.edu
Thu Apr 9 00:17:09 CEST 2009


In article <49DBC5C4.9050305 at codebykevin.com>,
 Kevin Walzer <kw at codebykevin.com> wrote:

> Russell Owen wrote:
> 
> > 
> > The normal Quit menu item has always worked fine for me until I switched 
> > to using Twisted framework. Now it does nothing.
> 
> I wonder if it's a conflict between the Tk and Twisted event loops? 
> Doesn't Twisted have its own event loop? (Never used Twisted myself.)

That is definitely the problem.

Twisted has an event loop and somehow it runs tk's event loop. The 
result works just fine -- my application and tk work normally -- until 
it is time to quit. That's when the trouble strikes: my application will 
not quit. I suspect the heart of the problem is that halting tk's event 
loop is not enough to halt Twisted's event loop.

The standard way to stop a Twisted application procedure is to halt 
Twisted's event loop (it's "reactor"). Normally that is easy to do. The 
problem is that MacOS X Aqua Tcl/Tk has a Quit menu item that seems 
hard-coded to something directly in tk (perhaps halt the event loop) and 
whatever it is, it is not enough to get Twisted's attention.

So I would like to find some way to modify the behavior of the MacOS X 
Aqua Tcl/Tk Quit menu item.

-- Russell



More information about the Tkinter-discuss mailing list