Python GUI

Phil Hunt philh at
Tue Aug 10 19:00:02 EDT 1999

In article <37B02965.B1FE0E8D at>
           paul at "Paul Prescod" writes:
> Have you looked into XUL, 

No ...

> XwingML

... no ...

> and Glade?

... and yes.
> I don't know whether these are exactly the same as what you are doing
> but they are certainly related -- and both already have implementations.
> Glade's is already in Python!

Glade is a GUI application that allows you to build a window visually.

My system (provisional name: ``Parrot'') is a command-line application
that takes an ascii file as input, and outputs a file containing source
code in your favourite language, to build the GUI.

> Phil Hunt wrote:
> > 
> > It is important to me that the tool is easy to use. This is because
> > I intend to use it myself!
> Obviously ideas of ease of use vary. Some might say that XML is easier
> to use because:
>  * all major text editors have a mode for it

all major text editors handle ascii well, too!
>  * it can be trivially parsed with existing code written in several
> languages

True; I don't think a parser for Python will be too difficult to 
write: my provisional spec only has 12 productions.

>  * APIs for tree manipulation are well known

True, but writing classes implementing recursive tree-structures
is almost trivial in Python. (One reason I like it).

>  * the syntax is (becoming) familiar

This is a good point.

>  * XML transformation languages (including some nice Python libraries)
> can convert your language into XUL and vice versa -- or whatever else
> comes along (and I have a feeling several of these interface description
> languages will come along ... there will likely be as many as there are
> widget toolkits)

What's XUL?

> You are certainly free to do it however you want. It's your language and
> it should be something you are comfortable with!

I will stick with my current format; but adding a feature to 
import/export to XML shouldn't be too difficult -- then I'd have
the best of both worlds.

> > It will also use the C preprocessor, so for example one could
> > write a macro for a label and associated textfield:
> > 
> > #define labelTF(txt,id,size) \
> >    label @id##Label txt textField @id cols=size
> XML has a similar facility but I think that textual preprocessing is a
> little gross whether done in C or XML. I would encourage you to consider
> structured alternatives. Whether you use C-syntax or XML syntax, you
> could rather have a first-class "object definition" syntax. SVG has such
> a thing for defining 2-dimensional shapes.

I am intending to do something like this. For example:

   sub.font = "Helvetica"

would mean: all components under the current component default to
using the Helvetica font. Similarly:

   all.button.bcol = "111133"

would make the background colour of all buttons default to dark blue.

Phil Hunt....philh at

More information about the Python-list mailing list