[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Layout module for Pygame surfaces



XML is only to save the programmer effort and was created because so
many languages can't process text and do not have good data
structures. It is not the best way for a user to hand enter a design
for a UI.  And in fact in python it makes the programmers job harder
because reading the file is easy, and having to learn to manipulate
XML is much more complicated than manipulating a python class or dict.

libavg should not be using XML - in fact its a good example of why
not. Why am I calling GetElementById() in their example? Because they
started with XML and got caught up in it. Make it python and its
node.logo instead of node.GetElementById(logo). You can rewrite their
XML example in a more readable and editable way, but they started with
XML and managed to mix in javascript.  If instead you do your own
thing you can make it much simpler and easier to use.

If you have to work with C, then really what XML is giving you is a
tree data structure to work with. You don't need that in python. I
suggest you make a pythonic way to do this in addition to this XML if
you have to have XML for working with C.

Mark

On Mon, May 17, 2010 at 7:03 PM, Jake b <ninmonkeys@xxxxxxxxx> wrote:
> I would use XML. It opens the audience to a larger group, and makes it
> easier for other tools to work with.
>
> This might work? Says it uses HTML for layout , python for scripting.
> http://www.libavg.de/concept.php
>
> see also, xrc tutorial: ( XML layout for wxwindows )
> http://wiki.wxpython.org/XRCTutorial
>
> --
> Jake
>