Pythonic gui format?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fuzzyman

    #31
    Re: Pythonic gui format?


    bruno at modulix wrote:[color=blue]
    > Fuzzyman wrote:
    > (snip)
    >[color=green]
    > > 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.[/color]
    >
    > Well, if the conf is valid Python, you've already get most of the
    > 'something to do the translation' for free !-)
    >[/color]

    Except he can't use ordinary dictionaries because they don't preserve
    order, which is one of his requirements...

    Your trivial example below redone with ConfigObj syntax :

    [window]

    widgets = , # empty list

    Code to read it :

    from configobj import ConfigObj
    gui_object = ConfigObj(filen ame)

    All thebest,

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

    [color=blue]
    >
    > --
    > bruno desthuilliers
    > python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    > p in 'onurb@xiludom. gro'.split('@')])"[/color]

    Comment

    • bruno at modulix

      #32
      Re: Pythonic gui format?

      Fuzzyman wrote:[color=blue]
      > bruno at modulix wrote:
      >[color=green]
      >>Fuzzyman wrote:
      >>(snip)
      >>
      >>[color=darkred]
      >>>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
      >>>configuratio n' in a text based format is a nice idea, but you will need
      >>>*something * to do the translation.[/color]
      >>
      >>Well, if the conf is valid Python, you've already get most of the
      >>'something to do the translation' for free !-)
      >>[/color]
      >
      >
      > Except he can't use ordinary dictionaries because they don't preserve
      > order, which is one of his requirements...[/color]

      Except that dict ordering (or lack of) is not a problem here, cf my
      other posts about this !-)

      --
      bruno desthuilliers
      python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
      p in 'onurb@xiludom. gro'.split('@')])"

      Comment

      • Marc 'BlackJack' Rintsch

        #33
        Re: Pythonic gui format?

        In <t9mdncjHu9hxE2 _eRVn-oA@comcast.com> , DH wrote:
        [color=blue][color=green]
        >> And what about true vs True and false vs False ?-)[/color]
        >
        > The syntax is the same, except for, as I said, JSON's multiline comments.
        > The semantics do differ, but that has nothing to do with the user's
        > question, about an alternative to XML for data representation. You
        > can use "true" or True or "null" or None or whatever semantic values
        > you want.[/color]

        You can't use `True`, `False` and `None` in JSON documents. And strings
        are delimited by `"` and not `'`. The `\x??` escape is forbidden in
        strings and it's not allowed to leave out a leading zero in numbers, nor
        is it allowed to start a number with a unary `+`.

        Ciao,
        Marc 'BlackJack' Rintsch

        Comment

        • bearophileHUGS@lycos.com

          #34
          Re: Pythonic gui format?

          Sorry for the late reply, I have some ideas about a possible GUI
          toolkit design (that works with one already done like GTK), I'll
          probably show them here. In the meantime I can show this one:


          I like it because the way GUIs are defined is quite short.

          bye,
          Bearophile

          Comment

          Working...