[PYTHONMAC-SIG] Mac Python with Tk -- early beta
Guido van Rossum
Sun, 18 Feb 1996 11:44:28 -0500
I have managed to build a 68K Python with Tk that can run Grail.
Download it from ftp://ftp.python.org/pub/mac/beta/, files
python68Kgusitk.sit.hqx, README-tk, and Tkinter.py.
Here's the README-tk file:
Mac Python with Tk -- early beta
The file python68Kgusitk.sit.hqx is a Binhexed, Stuffed Macintosh 68K
Python binary that supports John Ousterhout's Tk toolkit. It is just
the application binary -- you'll have to get one of the other
distributions (1.3 or 1.3.1) to get the Python library code; EXCEPT
there's a new version of Tkinter.py, which you *have* to use, sitting
(as a separate text file) in this directory.
I assume you are already familiar with running Python on your Mac --
if you aren't, you should definitely first download and try the 1.3 or
1.3.1 releases for Mac (this directory or one up). If you can't run
the EditPythonPrefs.py script, don't even think about running my
version. (Hint: EditPythonPrefs.py and EditPythonPrefs.rsrc must be
in the same directory.)
There's no PPC binary, because I haven't been able to build and test
one one yet. I hope I'll get to that within a few days. In the mean
time, the 68K binary *should* work on a PPC in emulation mode, but you
can't use Jack's nift applets or synamically loaded extension modules.
There are no source patches or project files yet, because I haven't
sorted out exactly what I did to make it work. In a while, I hope.
This uses the latest Tk beta release: Tcl 7.5b1 and Tk 4.1b1. This is
the first version I could get to work with Python on the Mac. I
didn't have to make any changes to the Tcl/Tk sources. There are
plenty of little bugs in the Tk beta; the most annoying is that it
will crash with a bus error if it tries to use font metrics before an
"update" or "update idletasks" has been done. For the time being, I
make this call in Tkinter.py as soon as the root window is created.
This means that you will see an an empty root window when your app
comes up, until your app withdraws it or adds widgets and calls
update() or mainloop().
This version also uses the GUSI library (Grand Unified Socket
Interface, by Matthias Neeracher). This means the full socket and
select modules are available. it does mean that all calls to
socket.makefile() must be patched to use 'rb' or 'wb' as the file mode
(this affects modules like ftplib, httplib, maybe urllib).
When using async I/O (select, Tk's createfilehandler()) intensively, I
noticed some weird effects where Python, Tk, GUSI and the SIOUX
console window seem to be competing for events. I got better results
by disabling Python's own event handling with the call
MacOS.EnableAppswitch(-1) -- I also added this to Tkinter.py. This
means you can't interrupt the Python code with Command-period.
With these provisions, it *does* run Grail (a patched version, not yet
distributed). it's a memory hog (notice the preferred memory usage of
6Meg). It is slow, though part of that is probably due to my 14k4
modem. It takes about 30 seconds for Grail to start up when all its
.pyc files are up-to-date (I ran Tools/scripts/compileall.py in the
Grail source directory to do this). Some smaller applets work -- I
had trouble with Life and Daleks though.
--Guido van Rossum <guido@CNRI.Reston.VA.US>
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: email@example.com
administrivia to: firstname.lastname@example.org