Python GUI

Paul Prescod paul at prescod.net
Tue Aug 10 22:57:01 EDT 1999


Phil Hunt wrote:
> 
> In article <37B02965.B1FE0E8D at prescod.net>
>            paul at prescod.net "Paul Prescod" writes:
> > Have you looked into XUL,
> 
> Glade is a GUI application that allows you to build a window visually.

Okay, but I saw a reference somewhere to Glade having a declarative file
format that could be converted into code to build the GUI. I was mostly
talking about the declarative file format.

> 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.

Glade does that too, as long as your "favorite language" is C. :)

I don't understand why you would take a code generation approach,
though. My professional opinion is that code generation is yucky. :) It
takes no more effort to write a "Parrot reader" for each language --
especially if Parrot uses the language's built-in XML support (oops.
scratch that). Seriously though, XML aside, why bother with code
generation when you can just do everything dynamically? Read the parrot
file and make the objects on the screen. The performance shouldn't be
much different and the extra dynamicity will make your life easier and
make the tool cooler to use. "I'll just generate a modified parrot file
and reload."

> >  * 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.

These specs always start out small. :)

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

Wait until you get to the TCL version!

> What's XUL?

Netscape's version of the same thing you are doing:

http://www.oasis-open.org/cover/xul.html

> 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.

True enough. I think history shows that one syntax or another always
ends up dominating, though. Lisp had two syntaxes once...

 Paul Prescod




More information about the Python-list mailing list