More Pythonic wrapper API for wxPython?

Are there any libraries for wxPython that make GUI construction/layout more streamlined? I'm imagining a set of context managers that take advantage of Python 2.5's with statement. (I miss this from more structure-declarative UI languages like Laszlo/JavaFX.) At the very least, the indentation `with` affords could make code easier to read/group together. Thanks.

···

--
Yang Zhang
http://www.mit.edu/~y_z/

Yang Zhang wrote:

Are there any libraries for wxPython that make GUI construction/layout more streamlined? I'm imagining a set of context managers that take advantage of Python 2.5's with statement. (I miss this from more structure-declarative UI languages like Laszlo/JavaFX.) At the very least, the indentation `with` affords could make code easier to read/group together. Thanks.

XRC or

gui_support is library for easy creation of GUI designs in wxPython.
Although it's quit stable, it's part of a larger project and therefor has a lot of dependencies, but these can easily be removed.

Warning:
Although this library might be very attractive to newbies,
the use of this library will prevent you from learning some of the basics of GUI,
specially of containers / sizers in wxPython.

Brief documentation can be found here
  http://mientki.ruhosting.nl/data_www/pylab_works/pw_gui_support.html
( as this website might move around,
this docpage can always be found through the redirector
http://pic.flappie.nl
look under paragraph PyLab_Works | GUI_support )

Download:
http://pylab-works.googlecode.com/files/Data_Python_Test.zip

cheers,
Stef

I would try Dabo. The UI is very easy to manage and is much more
Pythonic in it's syntax. It is really easy to use. We don't support
the with statement because of 2.4 legacy support, though it may be an
option to use. I would encourage you to take a look at it.
http://dabodev.com/

Nate Lowrie

···

On Sun, Nov 2, 2008 at 2:04 PM, Yang Zhang <yanghatespam@gmail.com> wrote:

Are there any libraries for wxPython that make GUI construction/layout more
streamlined? I'm imagining a set of context managers that take advantage of
Python 2.5's with statement. (I miss this from more structure-declarative
UI languages like Laszlo/JavaFX.) At the very least, the indentation `with`
affords could make code easier to read/group together. Thanks.

Hello,

its support all widgets and functionalities from wxPython? the package is still in development? is stable? support?

···

2008/11/2 Stef Mientki s.mientki@ru.nl

Yang Zhang wrote:

Are there any libraries for wxPython that make GUI construction/layout more streamlined? I’m imagining a set of context managers that take advantage of Python 2.5’s with statement. (I miss this from more structure-declarative UI languages like Laszlo/JavaFX.) At the very least, the indentation with affords could make code easier to read/group together. Thanks.

XRC or

gui_support is library for easy creation of GUI designs in wxPython.

Although it’s quit stable, it’s part of a larger project and therefor has a lot of dependencies, but these can easily be removed.

Warning:

Although this library might be very attractive to newbies,

the use of this library will prevent you from learning some of the basics of GUI,

specially of containers / sizers in wxPython.

Brief documentation can be found here

http://mientki.ruhosting.nl/data_www/pylab_works/pw_gui_support.html

( as this website might move around,

this docpage can always be found through the redirector

http://pic.flappie.nl

look under paragraph PyLab_Works | GUI_support )

Download:

http://pylab-works.googlecode.com/files/Data_Python_Test.zip

cheers,

Stef


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


Saludos / Best regards

Mario Lacunza
Consultor de Sistemas - Webmaster

Email: mlacunza [AT] gmail [DOT] com
Lima - Peru

Mario Lacunza wrote:

2008/11/2 Stef Mientki <s.mientki@ru.nl <mailto:s.mientki@ru.nl>>

    Yang Zhang wrote:

        Are there any libraries for wxPython that make GUI
        construction/layout more streamlined? I'm imagining a set of
        context managers that take advantage of Python 2.5's with
        statement. (I miss this from more structure-declarative UI
        languages like Laszlo/JavaFX.) At the very least, the
        indentation `with` affords could make code easier to
        read/group together. Thanks.

    XRC or

    gui_support is library for easy creation of GUI designs in wxPython.
    Although it's quit stable, it's part of a larger project and
    therefor has a lot of dependencies, but these can easily be removed.

    Warning:
    Although this library might be very attractive to newbies,
    the use of this library will prevent you from learning some of the
    basics of GUI,
    specially of containers / sizers in wxPython.

    Brief documentation can be found here
     http://mientki.ruhosting.nl/data_www/pylab_works/pw_gui_support.html
    ( as this website might move around,
    this docpage can always be found through the redirector
    http://pic.flappie.nl
    look under paragraph PyLab_Works | GUI_support )

    Download:
    http://pylab-works.googlecode.com/files/Data_Python_Test.zip

    cheers,
    Stef

    _______________________________________________
    wxpython-users mailing list
    wxpython-users@lists.wxwidgets.org
    <mailto:wxpython-users@lists.wxwidgets.org>
    http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hello,

its support all widgets

that I use :wink:
I think it will handle most widgets well, but that's not tested.
The files are part of a much larger application (about 200 windows), where the last 100 were all created with this tool.

and functionalities from wxPython?

what functionalities you mean ?

  the package is still in development?

yes

is stable?

we use it for about 4 months and didn't see any problems

support?

Only what is needed for the larger package,
but if I have the time I'll always try to help those who have trouble.

But what are we talking about, just about 200 lines of core code !!

cheers,
Stef

···

--
Saludos / Best regards

Mario Lacunza
Consultor de Sistemas - Webmaster

Email: mlacunza [AT] gmail [DOT] com
Lima - Peru
------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Yang Zhang wrote:

Are there any libraries for wxPython that make GUI construction/layout
more streamlined? I'm imagining a set of context managers that take
advantage of Python 2.5's with statement. (I miss this from more
structure-declarative UI languages like Laszlo/JavaFX.) At the very
least, the indentation `with` affords could make code easier to
read/group together.

The problem is that the context manager concept doesn't fit all that
well with the GUI models. In most cases, when you are constructing a
user interface, you call a "create" routine that creates all of the user
interface components. Those components live on well beyond the "create"
routine. The context manager concept works really well when you have a
resource that will be consumed within a well-define block of code and
then destroyed. That's not how the UI models work.

The "create my UI components" routine tends to be the ugliest in a UI
app. That's one reason, for example, why Visual Studio hides the
component creation routine in a C# program by default. You only see it
if you go out of your way to look for it.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

Yang Zhang wrote:

Are there any libraries for wxPython that make GUI construction/layout
more streamlined? I'm imagining a set of context managers that take
advantage of Python 2.5's with statement. (I miss this from more
structure-declarative UI languages like Laszlo/JavaFX.) At the very
least, the indentation `with` affords could make code easier to
read/group together.

The problem is that the context manager concept doesn't fit all that
well with the GUI models. In most cases, when you are constructing a
user interface, you call a "create" routine that creates all of the user
interface components. Those components live on well beyond the "create"
routine. The context manager concept works really well when you have a
resource that will be consumed within a well-define block of code and
then destroyed. That's not how the UI models work.

The "create my UI components" routine tends to be the ugliest in a UI
app. That's one reason, for example, why Visual Studio hides the
component creation routine in a C# program by default. You only see it
if you go out of your way to look for it.

I understand what you mean. What I'm interested in is something that lets me write stuff like the following (not real code, but at least very similar). The structure of the code reflects the structure of the GUI elements.

XHTML:

   <form method="..." action="...">
     <p>
       Choose an option:
       <select size="5">
         ...
       </select>
     </p>
     <p>
       Enter word:
       <input type="text" name="..."/>
       <input type="submit" value="Submit"/>
     </p>
   </form>

JavaFX:

   FlowLayout {
     alignment: VERTICAL
     contents: [
       FlowLayout {
         alignment: HORIZONTAL
         contents: [
           Label { text: "Enter word:" },
           TextField {},
           Button { text: "Submit" }
         ]
       }
     ]
   }

Laszlo:

   <vbox>
     <listbox values="..." />
     <hbox>
       <label text="Enter word:"/>
       <textedit width="100%"/>
       <button text="Submit"/>
     </hbox>
   <vbox>

My imagined wx API for Python:

   with form.add(VBox()) as vbox:
     vbox.add(ListBox(options=...), 1, EXPAND)
     with vbox.add(HBox()) as hbox:
       hbox.add(StaticText(label='Enter word:'), 0, EXPAND)
       hbox.add(TextCtrl(), 1, EXPAND)
       hbox.add(Button(label='Submit'), 0, EXPAND)

or:

   with form.vbox() as vbox:
     vbox.listbox(1, EXPAND, options=...)
     with vbox.hbox() as hbox:
       hbox.statictext(0, EXPAND, label='Enter word:')
       hbox.textctrl(1, EXPAND)
       hbox.button(0, EXPAND, label='Submit')

···

--
Yang Zhang
http://www.mit.edu/~y_z/

We have a structure in Dabo that is xml based and allows you to do
something similar to the xhtml example. It is pretty easy to code by
hand.

Nate L.

···

On Mon, Nov 3, 2008 at 5:07 PM, Yang Zhang <yanghatespam@gmail.com> wrote:

I understand what you mean. What I'm interested in is something that lets
me write stuff like the following (not real code, but at least very
similar). The structure of the code reflects the structure of the GUI
elements.

Yang Zhang wrote:

I understand what you mean. What I'm interested in is something that
lets me write stuff like the following (not real code, but at least
very similar). The structure of the code reflects the structure of
the GUI elements.
...
My imagined wx API for Python:

  with form.add(VBox()) as vbox:
    vbox.add(ListBox(options=...), 1, EXPAND)
    with vbox.add(HBox()) as hbox:
      hbox.add(StaticText(label='Enter word:'), 0, EXPAND)
      hbox.add(TextCtrl(), 1, EXPAND)
      hbox.add(Button(label='Submit'), 0, EXPAND)

Yes, I can see where you're going. However, remember the following:
* wxPython was designed to be a relatively thin wrapper over wxWidgets
* wxWidgets was designed as a way to exploit the native GUI tools sets

So, neither product was designed with the aim of providing a new and
glorious UI philosophy. Rather, they were designed to look and work
like the native widgets and APIs in a cross-platform way. As a result,
using them tends to look a bit like yesterday's code.

There are certainly people doing some clever things as a wx
preprocessor. One of the list members has a very clever scheme for
defining menus, basically using a multi-line string that look just like
the desired menu layout. Some of that could be extended in the way
you're describing.

Have you looked at xrced? There, you use XML to describe the layout,
load it in with a single Python statement, and start handling function
with code-behind. It's an approach vaguely similar to WPF.

I thought the "with" statement basically destroyed its resource when it
closed. I'd be uncomfortable using that as a syntax, just because it
doesn't really reflect what's going on.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.