[Pythonmac-SIG] How to get a Mac OS X version of Tcl/Tk rather than X11 version.
Lou Pecora
lou_boog2000 at yahoo.com
Thu Jan 27 21:41:10 CET 2011
----- Original Message ----
From: Ned Deily <nad at acm.org>
To: pythonmac-sig at python.org
Sent: Thu, January 27, 2011 2:18:15 PM
Subject: Re: [Pythonmac-SIG] How to get a Mac OS X version of Tcl/Tk rather than
X11 version.
In article <960836.10021.qm at web34405.mail.mud.yahoo.com>,
Lou Pecora <lou_boog2000 at yahoo.com> wrote:
> I have an installation of Python 2.6.4 on my MacBook Pro (OS X 10.6) that by
> default uses X11 windows and dialogs rather than the Mac version of those GUI
> items. In my googling and exchanges on other support groups I've come down
> to
> the problem may be with the Tcl/Tk installation using the "generic" X11 GUI
> rather than the Mac version. Does anyone know how I can change that in the
> Tk
> part of the python framework?
Which Tcl/Tk is used by Python depends on the way the Python you are
using was built. The Apple-supplied Pythons in OS X and the Pythons
installed from python.org and some 3rd-party suppliers (like ActiveState
Python) use the "native" Aqua Tk, the most common versions being those
shipped by Apple with OS X or the ActiveState Tcl/Tk distribution of OS
X. Python 2.6.4 is not the version shipped by Apple in 10.6 so you must
have built or installed another version. `which python` will tell you
where it is installed. If the path starts with "/opt/local/" chances
are you using a MacPorts Python; currently the MacPorts Python uses a
MacPorts Tk port which by default is built with X11, rather than as a
Aqua Tk. The MacPorts Tk port does have a "+quartz" variant which is
supposed to build Aqua Tk but it currently does not work on 10.6.
To get back to using an Aqua Tk, you can install the most recent 2.6
Python (2.6.6) from python.org:
http://www.python.org/download/releases/2.6.6/
It uses Aqua Tk 8.4 and is 32-bit only. Note that 2.7.1 and 3.1.3 (soon
to be 3.2) are the current versions of Python.
--
Ned Deily,
Thanks, Ned. I found the solution to my particular problem.
You are right. I'm using the SAGE package which includes a full supply of
python (numpy, scipy, Cython, etc.etc.). SAGE builds against the Apple Tcl/Tk
Frameworks in /System/Library/Frameworks *unless* there's another Tcl/Tk
Framework in /Library/Frameworks. I installed such a framework before running
the SAGE install. That's where SAGE python picked up the X11 GUI instead of the
Aqua GUI in Tk calls.
Solution: Remove the /Library/Frameworks Tcl and Tk versions. Then SAGE will
build against the Apple Tcl and Tk frameworks. And you see Tk dialogs and
Windows in Aqua.
I got the hint from some helpful fellow to run otool -L _tkinter.so on the
_tkinter.so in down in the python /lib-dynload folder. Doing that in Apple
python and SAGE python pointed to different Tcl/Tk frameworks and helped solve
the problem.
I posted this separately on this list, too.
-- Lou Pecora, my views are my own.
More information about the Pythonmac-SIG
mailing list