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.)


If...you are talking about the "Quit" entry in the app menu, try something like this:

self.bind('Command-Key-Q', lamdba event: sys.exit())


What should self be to bind this application-wide (for all windows and widgets)? Root doesn't seem to accept key events.


My apps inherit directly from Tk/Tkinter itself:

class quickwhoApp(Tk):

    def __init__(self, parent):
        Tk.__init__(self, parent)
        try:
            self.tk.call('console', 'hide')
        except TclError:
            pass

if __name__== '__main__':
    app = quickwhoApp(None)
    app.mainloop()

Binding to self works for me under these circumstances.



(Also, although this is much better than nothing, presumably it will not actually support the Quit menu item? If so, I hope to find a more thorough solution.)

-- Russell

Not sure--as I saisd, I think adding Twisted to the mix makes things more complex.

Kevin


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to