Issue 1691411: Duplicate "preferences" menu item/Tk Aqua 8.4.14 (original) (raw)

Version 8.4.14 of Tcl/Tk Aqua (for OS X) hard-codes a "Preferences" item in the Apple menu. As a result, IDLE now has two "Preferences" items--the active one that is coded by default, and an inactive item that is hard-coded by Tk.

The way to work around this is to check the version of Tk that is present, in this fashion:

tkversion=Tkinter.Tk().tk.eval('info patchlevel')

If it is 8.4.14 or greater, then you should bind IDLE's "preferences" dialog to the hard-coded menu item in Tk (and remove the "preferences" menu entry that comes with IDLE). It can be done in this fashion:

Tkinter.Tk().createcommand('::tk::mac::ShowPreferences', IDLEpreferencesfunction) ##substitute the correction function name here

If tkversion <= '8.4.13', leave things as they are.

I have tried to put together a patch for this, but I'm not sure where the correct place to add this code is. I've looked at Bindings.py and macosxSupport.py, but it doesn't work as expected (in macosxSupport.py, it simply ignores the code; in Bindings.py, it removes IDLE's preferences item, but doesn't activate the hard-coded one). So I'm leaving this to someone with a greater knowledge of IDLE's internal structure to apply.