Python and Tk on MacOSX
The standard binary installation of Python on MacOSX does not include
Tkinter. You can use Tkinter on MacOSX, but you have to download
TclTkAqua yourself and build Python from source.
Here is a recipe that works for me on MacOSX 10.2 with Python 2.3.3:
- Download and install TclTkAqua from http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/
(I used the 8.4.4 Batteries Included installer but I only installed Tcl
and Tk. The plain-vanilla TclTkAqua installer would probably be fine as
well.)
- Download and uncompress the source distribution of Python, the
one listed as "for Unix or OS X compile".
- If you are building under MacOSX 10.2, you have to make a change
to /Python-2.3.3/Mac/OSX/Makefile. Uncomment line 14 (remove the #) and
comment line 16 (add a #).
- In Terminal cd to the Python directory and enter the commands
- ./configure --enable-framework
- make
- sudo make frameworkinstall
This will build /Library/Frameworks/Python.framework and
/Applications/MacPython. At this point I can
- run python and pythonw from Terminal
- run PythonIDE (the Mac IDE) by double-clicking the launcher in
the MacPython folder
- run IDLE by double-clicking the launcher in the MacPython folder
(The IDLE launcher didn't work for me with Python 2.3.1. But the
command 'pythonw idle' where idle is in the current directory, worked
for me to launch IDLE. Or just look at the idle file and type the two
lines yourself.)
Note that to run ANY Python GUI on MacOSX, you have to run with pythonw
or PythonLauncher.