Is there a graphical GUI builder?
r.koebler at yahoo.de
Wed Feb 20 10:34:50 CET 2013
> That way of building a window tends to produce programs that port
> badly to other systems.
hmm, I don't think so. I've build several applications in C + GTK/Glade and
Python + GTK/Glade, which easily run on Linux and Windows without any GUI
> playing with Java applets introduced
> the novel and somewhat strange idea that your window should be built
> using rules and layouts, to avoid problems with button sizes, fonts,
> etc, etc.
Do you know the container-concept of GTK+ and Glade?
In many GUI-builders, you set your widgets to fixed positions (e.g. a text
field at x16/y16 with 100*30 pixels, a button at x16/y50 with 100*50 pixels
etc.). This is *bad*, and causes all kinds of problems with e.g. different
window- or font-sizes, like widgets outside of the visible window, text
running over the border of a widget or being cut at the edge of the widget
But: GTK+ has a wonderful concept of "containers" [*]. You normally don't
set widgets to fixed positions -- instead, you add layout tables (or
vertical boxes or horizontal boxes or ...), and essentially define
that some widgets should be above each other, side by side or in a grid
layout, so you more or less define the layout logically. The real size
and position of the widgets is dynamically calculated by GTK+, so they
always have the right size, and different font sizes, different window
sizes, etc. are not a problem anymore [q]. And Glade (the GTK+ GUI builder)
works exactly that way.
[*] Besides, the container-concept also allows such nice things like
putting anything inside a button (e.g. 2 images and a label), or inside
a notebook tab etc. pp.
[q] In Qt, it's also possible to generate such flexible layouts. But
it's unfortunately not the default way in Qt, and the Qt designer only
supports it rudimentarily, and in a much less obvious way. And Qt does
not have such a "container"-concept, where many widgets (e.g. buttons,
notebook registers etc.) contain other widgets.
> You have to think about your window differently - think about what
> you're putting where, rather than going visually "that looks about
> right" - but the reward is that it'll look right no matter where you
> run your app.
Yes, that's also true for GTK+/Glade.
But you have the choice to either build you GUI graphically with your
mouse, or textually in your editor -- or mix both.
More information about the Python-list