[Pythonmac-SIG] Re: anybody doing GUI development with Python

Jon Moody jbmoody@oakland.edu
Sat, 16 Jun 2001 11:10:32 -0400


On Sat, Jun 16, 2001 at 11:27:41AM +0100, tom smith wrote:
> I too am trialling jython (although I couldn't get it going on OS9), have
> mucked about with Tkinter and not really liked the results (there is no Tk
> gui builder for X or OS9) and RealBasic.

There are several Tk GUI builders; 
see http://tcl.activestate.com:8002/resource/software/tools/guibuilder

I've used SpecTcl (http://spectcl.sourceforge.net/) under MacOS8.6,
SGI IRIX, and Linux; it has 2 different Python code generator
back-ends,

1. http://www.geocities.com/eric_brunel/SpecPython.en.html
2. ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/Graphics/Tkinter/SpecPython0.2.tgz

as well as has a new maintainer.

The first SpecPython generates fairly ugly code, while the second
seems to generate cleaner code which can be more easily edited.  Both
generate code as gui classes to capitalize on Python OO advantages.

SpecTcl needs a Tcl interpreter to run (MacOS classic needs
ftp://tcl.activestate.com/pub/tcl/mac/TclTk_8_3_2p1_RtimeInstall.bin,
or for OSX, compile from source from
ftp://tcl.activestate.com/pub/tcl/tcl8_3/), which should be installed
before SpecTcl.

If you want to use one of the SpecPython backends, you have add the 2
files--'preferences.tk' and 'python_init.tk', which come with each
backend--to the SpecTcl 1.1 binary file.  Just open the SpecTcl 1.1
binary using something like the ResEdit program, add a new 'TEXT'
resources (change the ID to a high number not already used, say 4110),
then copy and paste the contents of 'python_init.tk' into the new
'TEXT' resource, and save.  There's already a 'preferences.tk'
resource; you can make a backup copy of its contents if you want, then
copy and paste in the contents of the new SpecPython 'preferences.tk'.
When you run SpecTcl 1.1, you will either be prompted for the target
language at the beginning, or you can change it from the menu
'Preferences' -> 'Options...' -> 'Target'.  These machinations are
probably not necessary under OSX; I don't have OSX, but I would guess
SpecTcl runs there just like under IRIX or Linux.

Tkinter on the Mac is not very Mac-like, but it definitely works,
including the Pmw package.  If you alreadly know Python and don't have
time to learn Java/Jython, Tkinter's the only x-platform gui that
works _today_.

Incidently there is a drop-in replacement for tk_messageBox which
provides a native Mac-like 'movable alert'
(http://hem.fyristorg.com/matben/download/MovableAlerts.sit).  

Jack, would it be possible to add this to _tkinter.*.slb?  It looks
like a trivial change, but I don't have CW to try.

--
Jon