[Pythonmac-SIG] InterfaceBuilder, wxPython, tkinter & other GUIs

Jack Jansen jack@oratrix.nl
Sat, 17 Mar 2001 00:04:32 +0100


I've been playing around with InterfaceBuilder yesterday and today,
and I must say that I'm really excited about the possibilities.

InterfaceBuilder is sort-of the OSX equivalent for ResEdit/Resorcerer, 
it allows you to create dialogs, menus, windows, etc. Aside from
having a much better user interface than those it has one feature
for which I can really see great opportunities: the main output file
is an XML definition of the dialogs, windows, etc that you've made.

>From this XML it should be reasonably simple to generate a Python
class hierarchy, I think. Moreover, there's fields in the XML for
things like command IDs and such, so you could then easily inherit
these classes in your application.

You'd get a class hierarchy like
class MacOSButton:	# standard class with button behaviour
    # standard methods for buttons like set(), get(), etc.
class Button_name(MacOSButton, AppButton_name):	# Generated from the XML
    title = "push me"
class AppButton_name:	# In your application
    def push_callback(...):
        # Your callback method
    etc...

To make things even more interesting we could probably also turn the
XML into Rez input, so the dialog works on Pre-Carbon macs too. Or we
could replace the MacOSButton base class with a Win32Button and
generate the windows .rc file and have the base for a Windows program.
And the same probably for other GUI packages...

That the file format is XML makes a lot of things easier. There is
good support for XML in Python, and there are various tools around to
massage XML. This you could use to do, say, platform-specific edits on 
the XML (based on names or id's or even labels of the ui elements)
automatically. You could also use it to do checks (make sure every
command used in your app has a button, and make sure every button has
a command).

If people are interested in this sort of thing: let me know. I can
probably invest some time into it in the near future: we have to do a
gazilion new dialogs for Windows and Mac for GRiNS, and the current
process is rather painful, so if I can speed it up with a bit of work
ahead I can justify the time. Doing this all by myself if probably not 
going to work, but with a few hands we might come up with something
nifty in a reasonable timeframe.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm