Tkinter on mac - Binding command-q to quit application

Brandon bmbeck at gmail.com
Sat Nov 26 14:34:43 EST 2005


Hi All,

I'm attempting to develop a Tcl/Tk application on the mac using python
and Tkinter.  The one problem I'm having is adding basic keyboard
support to my application, specifically binding command-q so that it
quits the application (this is standard behavior for almost every mac
application, the equivalent of alt-f4 on windows).  Has anyone
successfully been able to do this?  If so, could you please share some
code which demonstrates how?


If it matters, I've been working with both python 2.3.5 and python
2.4.1:

     >>> print sys.version; print "-"*30; print Tkinter.__version__
     2.3.5 (#1, Aug 22 2005, 22:13:23)
     [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)]
     ------------------------------
     $Revision: 1.177 $

and on python 2.4:

     >>> print sys.version; print "-"*30; print Tkinter.__version__
     2.4.1 (#2, Mar 31 2005, 00:05:10)
     [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)]
     ------------------------------
     $Revision: 1.181.2.1 $


Thanks in advance,
Brandon




More information about the Python-list mailing list