Pythonic gui format?

Fuzzyman fuzzyman at gmail.com
Wed Feb 15 06:40:44 EST 2006


Gregory Petrosyan wrote:
> > > Isn't it ugly a bit?
> >I'd even say 'ugly 16-bits' !-)
>
> You are right of course. Those  "examples"  are really bad, and, most
> of all, really un-pythonic.
>
> Thanks for JSON. It's more clean&simple than XML, but my main idea is
> to remove any extra layer between Python and GUI. I want all GUI
> elements/data to be directly accessible from Python (without extra
> libraries).
> Your dicts example is nice, but this  approach (and some others) lacks
> one important feature: ordering of GUI elements. In XML, the order of
> all elements is specified, and with dicts (or with very clean Georg's
> model) it is not. (BTW remember topics about ordered dicts...)
>

ConmfigObj is *another* configuration module that has a nice syntax for
storing data. It will effectively store nested dicts with single items
or lists for values. You access members using the mapping protocol
(ordinary dictionary syntax), but members *are* ordered. (ConfigObj
instances are effectively ordered dictionaries as well.)

You say you don't want an 'extra layer' between your GUI  and Python -
but your approach of using XML has the same drawback. Storing your 'GUI
configuration' in a text based format is a nice idea, but you will need
*something* to do the translation.

    http://www.voidspace.org.uk/python/configobj.html

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

> I think that there should be a way for solving this problem, and I'll
> certainly try to find it.
> Thanks for your help.




More information about the Python-list mailing list