[issue11055] OS X IDLE 3.2 Save As menu accelerator opens two Save windows

Ned Deily report at bugs.python.org
Thu Mar 17 08:22:06 CET 2011


Ned Deily <nad at acm.org> added the comment:

The actual unwanted event is being generated as a result of the menu "add command" accelerator.  You can see that by playing with Wish.

set w .menu
catch {destroy $w}
toplevel $w
wm title $w "Menu Shift"
menu $w.menu -tearoff 0
set m $w.menu.basic
$w.menu add cascade -label "Basic" -menu $m -underline 0
menu $m -tearoff 0

$m add command -label "Test" \
	     -command "puts command" -accelerator Command-Shift-A
bind $w <Command-Shift-A> "puts bind"

$w configure -menu $w.menu

It appears that there is a bug in the Cocoa Tk right now where accelerators with "Shift" (at least) in them are not being properly ignored by Tk.  In the Carbon Tk and the X11 Tk, I believe the only effect of the "accelerator" definitions on the "add command" is to be used to create the shortcut characters displayed in the menu entry.  However, apparently a side effect of using the Cocoa APIs is that the menu definitions now cause notifications back into Tk which are not supposed to be translated into Tcl/Tk events back to the app.  For some reason, the shift ones are not being ignored.

https://github.com/das/tcltk/blob/master/tk/macosx/tkMacOSXMenu.c

Also, it seems that with all three of the Tk implementations (Carbon, X11, and Cocoa), using a capital letter for the menu accelerator implies Shift.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11055>
_______________________________________


More information about the Python-bugs-list mailing list