Thank you very much!
That is exactly the information I needed. It worked perfectly. I
already had a module that added a Quit/Exit menu for unix/Windows and
I just modified it to map the "exit" command to my quit function on
MacOS X. Just one new line of code and my application now quits
correctly!
-- Russell
On Apr 8, 2009, at 4:02 PM, Kevin Walzer wrote:
So I would like to find some way to modify the behavior of the
MacOS X Aqua Tcl/Tk Quit menu item.
Russell,
This requires some Tcl code.
According to the Tcl/Tk Aqua FAQ at http://wiki.tcl.tk/12987,
Command-Q (and the Quit menu item) trigger the kAEQuitApplication
event, which is mapped to Tcl's "exit" (identical to sys.exit)
command.
The way to change this is to map the "exit" command to something
else. This is so trivial to do in Tcl that it's actually dangerous
(I've had apps crash on me because I named an image
"exit"). ...Something like this would probably get close to what
you're looking for:
def printfoo:
print "foo"
self.createcommand('exit', printfoo)
In other words, this should override the hard-coded "quit" function
by mapping the "exit" Tcl command to something else. Then you could
add your own event handler for Command-Q.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss