Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

Chris Angelico rosuav at gmail.com
Sun Jun 10 19:15:49 EDT 2012


On Mon, Jun 11, 2012 at 5:37 AM, Dietmar Schwertberger
<maillist at schwertberger.de> wrote:
> Chris Angelico wrote (in two posts):
>
>> There was a time when that was a highly advertisable feature - "build
>> XYZ applications without writing a single line of code!". I've seen it
>> in database front-end builders as well as GUI tools, same thing. But
>> those sorts of tools tend not to be what experts want to use. You end
>> up having to un-learn the "easy way" before you learn the "hard way"
>> that lets you do everything.
> This time is not over.
> Especially when you look at data acquisition and control applications
> where tools like Labview are widely used.
> Personally, I would not want to use such tools as I find it quite
> complicated to implement any logic with a graphical editor.
> But when you want to sell an alternative to such tools, then you
> should not offer a tool which makes it almost impossible for a
> typical engineer to create a simple GUI.
>
> [chomp lots of other examples - go read 'em in the original post :) ]

Either these people know how to write code, or they don't. If they do,
then building a simple GUI shouldn't be beyond them; if they don't
know that much code, then anything more than trivial _will_ be beyond
them. Here's the window building code from something I just knocked
together, with all comments stripped out:


        object mainwindow=GTK2.Window(GTK2.WindowToplevel);
        mainwindow->set_title("Timing")->set_default_size(400,300)->signal_connect("destroy",window_destroy);
	GTK2.HbuttonBox btns=GTK2.HbuttonBox()->set_layout(GTK2.BUTTONBOX_SPREAD);
	foreach (labels,string lbl)
		btns->add(buttons[lbl]=button(lbl,mode_change));
        mainwindow->add(GTK2.Vbox(0,0)

->add(GTK2.TextView(buffer=GTK2.TextBuffer())->set_size_request(0,0))
                ->pack_start(btns,0,0,0))->show_all();

If you're a complete non-programmer, then of course that's an opaque
block of text. But to a programmer, it ought to be fairly readable -
it says what it does. I'm confident that anyone who's built a GUI
should be able to figure out what that's going to create, even if
you've never used GTK before. (And yes, it's not Python. Sorry. I
don't have a Python example handy.)

Modern UI toolkits are generally not that difficult to use. Add just a
few convenience functions (you'll see a call to a "button" function in
the above code - it creates a GTK2.Button, sets it up, and returns
it), and make a nice, well-commented configuration file that just
happens to be executed as Python, and you've made it pretty possible
for a non-programmer to knock together a GUI. They'll have learned to
write code without, perhaps, even realizing it.

ChrisA



More information about the Python-list mailing list