[Pythonmac-SIG] Application menu with BundleBuilder

John P Speno speno at isc.upenn.edu
Thu Dec 11 12:57:05 EST 2003


On Wed, Dec 10, 2003 at 05:58:17PM -0800, Antoine Picard wrote:
> I'm using BundleBuilder to package a tkinter-based script on MacOS 
> X.2.8 and I'm running into some weirdness where none of the key 
> strokes associated with that menu (particularly Cmd-Q and Cmd-H) 
> work. However, using the mouse to select those menu items does do the 
> right thing.
> 
> I define two of my own key combos with:
> self.master.bind("<Command-e>", self.foo)
> self.master.bind("<Command-j>", self.bar)

I seem to recall having a similar issue. I may have posted to the
mac-tcl/tk list about it, so maybe you can search there for my name.

Here's some code from my app that does work. Maybe this will help:
        
    self.event_add('<<Cut>>', '<Command-Key-x>')
    self.event_add('<<Copy>>', '<Command-Key-c>')
    self.event_add('<<Paste>>', '<Command-Key-v>')
    self.event_add('<<Close>>', '<Command-Key-w>')
    quit = lambda e, parent=self: Quit.Confirm(parent)
    self.bind_all('<Command-Key-q>', quit)

I suppose you could try bind_all() with your Menu accelerators.  I think
that's what I switched to when just bind() didn't work.

Good luck.



More information about the Pythonmac-SIG mailing list