Python GUI

Martijn Faassen m.faassen at vet.uu.nl
Tue Aug 10 04:52:31 EDT 1999


Phil Hunt <philh at vision25.demon.co.uk> wrote:
> In article <7om59k$cqc$1 at newshost.accu.uu.nl>
>            m.faassen at vet.uu.nl "Martijn Faassen" writes:

>> Phil Hunt <philh at vision25.demon.co.uk> wrote:
>> > I'm currently writing a generic GUI builder.
>> 
>> > It doesn't (and won't) have a graphical user interface, the user
>> > will write a user interface definition file, which will then be
>> > compiled by my tool into the programming language and GUI toolkit of
>> > your choice. A definition file might look like this:
>> 
>> [snip definition file example]
>> 
>> Why not use XML for this?

> IMO XML is too verbose. I want to be able to say:

>    textfield @Name "initial text"

> instead of:

>    <textfield id="Name" text="initial text"/>

> It is important to me that the tool is easy to use. This is because
> I intend to use it myself!

I see, that makes sense, but you do lose all the work that's being put into
XML, and all the hype, and standard Python libraries to deal with XML, etc.

Perhaps you can make it so that your abbreviated format can be readily
translated to XML?

> Also, IIRC XML is restrictive where it allows comments -- you can't put
> them just anywhere. My GUI builder will allow C++-style comments.

I'm not sure exactly on the XML rules for comments, but you can put them
before and after tags, I'm sure, which is quite a lot already. But again,
a preprocessor that turns your format into XML could work here.

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

You'd need a separate XML preprocessor to do something like this (or 
again just use XML for the backend). I'll stop harping on the XML for now,
I was just wondering; it would make it easier for people to pick up this
GUI definition language, and it seems applicable.

Regards,

Martijn





More information about the Python-list mailing list