M
Morton Goldberg
On Macintosh OS X, one can use 'Command' and 'Option' as Tk event
type modifiers to get Command and Option key shortcuts. For example,
Tk.root.bind('Command-q') {exit}
Tk.root.bind('Command-Q') {exit}
will give the normal quit-key behavior. Also, if info_mnu is an
instance of TkMenu,
Tk.root.bind('Button-2') {|e| info_mnu.popup(e.root_x, e.root_y)}
Tk.root.bind('Control-Button-1') {|e| info_mnu.popup(e.root_x,
e.root_y)}
will make info_mnu into a contextual menu. The first binding will
serve users with a two- or three-button mouse and the second will
serve those with a one-button mouse.
'Command-' is an alias for 'M1-' and 'Option-' is an alias for 'M2-'.
All of the documentation on Tk event modifiers I've seen so far
doesn't mention this, so I thought I'd post it here. On a Google
search I found a blog reference to 'Command', but nothing on
'Option'. So I don't think this is widely known, but if I'm wrong, I
apologize for this posting.
Regards, Morton
type modifiers to get Command and Option key shortcuts. For example,
Tk.root.bind('Command-q') {exit}
Tk.root.bind('Command-Q') {exit}
will give the normal quit-key behavior. Also, if info_mnu is an
instance of TkMenu,
Tk.root.bind('Button-2') {|e| info_mnu.popup(e.root_x, e.root_y)}
Tk.root.bind('Control-Button-1') {|e| info_mnu.popup(e.root_x,
e.root_y)}
will make info_mnu into a contextual menu. The first binding will
serve users with a two- or three-button mouse and the second will
serve those with a one-button mouse.
'Command-' is an alias for 'M1-' and 'Option-' is an alias for 'M2-'.
All of the documentation on Tk event modifiers I've seen so far
doesn't mention this, so I thought I'd post it here. On a Google
search I found a blog reference to 'Command', but nothing on
'Option'. So I don't think this is widely known, but if I'm wrong, I
apologize for this posting.
Regards, Morton