[Pythonmac-SIG] IDLE fixes for 2.x and 3.x

Ned Deily nad at acm.org
Tue Feb 10 19:20:06 CET 2009


In article <49919728.6020003 at codebykevin.com>,
 Kevin Walzer <kw at codebykevin.com> wrote:
> Ned Deily wrote: 
> > The patches included have been tested on 2.6, 2.7, 3.0, and 3.1 as 
> > indicated.  I believe that, with these patches applied, IDLE.app and 
> > command line idle (bin/idle) on all of these systems will exhibit
> > the same behavior regarding menus and key definitions.[1]  In 
> > particular, the often missing-in-action Preferences menu option should 
> > be home for good.
> My version of IDLE (Python 2.6.1, Tk 8.5.3) shows the preferences menu 
> just fine, under the IDLE application menu. (Right under "About IDLE." )
> 
> I submitted a patch on this a year or two ago because recent versions of 
> Tk Aqua (> 8.4.14) hard-code in the "preferences" menu in that location, 
> and IDLE was showing it twice. My patch tested for the Tk version and 
> then loaded only one prefs menu.
> 
> I'm not sure if trunk versions of Python have broken this or not, but 
> please confirm the patch is needed before applying it.

That code is still there and should be unaffected by the new patches. 
The check for Tk Aqua >= 8.4.14 takes a different path and 
unconditionally adds the Preferences menu.  For earlier versions of Tk, 
like the Apple-supplied one in 10.5 and with which the python.org 2.6.1 
distribution is built, the menu altering fails in IDLE.app because of a 
premature import during initialization in idlemain.  There are other 
menu issues addressed: for instance, bin/idle may have the Preferences 
menu but may also have a Options->Configure menu and a Windows (instead 
of Window) menu.

Let me know if you run into any problems building with a non-Apple 
Tcl/Tk.

> > [1] One minor difference: bin/idle still has an application name of 
> > "Python" in menus and the dock while IDLE.app is "IDLE". 
> That's a function of the Aqua environment--when IDLE is double-clicked 
> from an app bundle, it's IDLE.app; when it's run from the command-line, 
> it's run by Python.app. Can't be avoided.

Well, one *could* cheat a bit, something like:

$ cat idle
#!/bin/sh
open -a '/Applications/Python 2.6/IDLE.app' $@

To me, that's actually simpler in concept than what goes on under the 
covers to launch IDLE.app itself.

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list