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

Rick Johnson rantingrickjohnson at
Sun Jun 10 21:36:23 CEST 2012

On Jun 9, 8:25 am, Dietmar Schwertberger <n... at>

> Before anyone now writes "Good GUIs are coded by hand":
> I agree, but for many purposes only simple GUIs are required
> and it should be possible to create these without studying manuals
> (on toolkit and GUI editor).

It is possible. Try Tkinter for the "get-you-from-a-to-b" solution,
or, wxPython if you like fog lamps, heated seats, and navigation

> A typical simple GUI would e.g. be for a measurement / data aquisition
> program, where you just need some buttons and fields.

Buttons and feilds are just a few short lines of code. Look. You guys
don't need a visual GUI builder. What you need to do is stop being
lazy and spend a few hours studing the basics of Tkinter and wxPyhon
(or whatever else suits your needs). IMO, every single python
programmer who needs GUI interfaces should know the basics of AT LEAST
Tkinter without even looking at the docs. I mean, how difficult is:

import Tkinter as tk
from Tkconstants import *
root = tk.Tk()
for x in range(10):
    f = tk.Frame(root)
    f.pack(fill=X, expand=YES)
    l = tk.Label(f, text="Field_"+str(x))
    l.pack(side=LEFT, anchor=W)
    e = tk.Entry(f)
    e.pack(side=LEFT, fill=X, expand=YES)
# Or even better. Use grid!
root = tk.Tk()
root.columnconfigure(1, weight=1)
for x in range(10):
    l = tk.Label(root, text="Field_"+str(x))
    l.grid(row=x, column=0, sticky=W)
    e = tk.Entry(root)
    e.grid(row=x, column=1, sticky=W+E)
# Or become a pro and create reusable objects!
class LE(tk.Frame):
    def __init__(self, master, **kw):
        tk.Frame.__init__(self, master)
        self.l = tk.Label(self, **kw)
        self.e = tk.Entry(self)
        self.e.pack(side=LEFT, fill=X, expand=YES)
root = tk.Tk()
for x in range(10):
    le = LE(root, text="Field_"+str(x))
    le.pack(fill=X, expand=YES)

> I think that something in the style of Visual BASIC (version 6) is required
> for either wxPython or PyQt/PySide (or both).
> In the Visual BASIC editor you can e.g. add a GUI element
> and directly go to the code editor to fill methods (e.g. an OnClick
> method).

With Tkinter you add a GUI element IN THE CODE and then you are
ALREADY in the code editor! What an amazing concept! No juggling
editors and windows. No need to mentally switch from one language to
another. Can you imagine how productive you could be?

> If you have not used VB before, you should just try it. You can create
> GUIs within a few minutes even if you haven't used it before.

Allow me to qualify that very naive generalization: "ANYBODY and point
and click, very few can actually write code".

> (Sure, the fact that anyone can use it has the side effect that most
>   of these GUIs are not good...)

Well i see that you agree. Look. This is fact. GUI's require you to
write code. You cannot get around this fact. Sure, you can create some
templates. But in the end, you will have to write in order to link the
templates together.

I say. If your GUI kit gives you the feeling that you are writing too
much boilerplate, well, then, it's time to wrap up some re-usable
functionality on your own. I have done this myself with Tkinter AND Wx.
( although much more so with Tkinter being that is a poorly designed

> Also:
> Such an editor should support simple manual layouts without enforcing
> the use of sizers (wx) or layout managers (Qt).
> These add an additional level of complexity which is not required
> for simple GUIs.

See above code for example of *gasps* simple layouts in REAL code!

> Background:
> I'm using Python in a corporate environment but I'm more or less
> the only one using it. I could propagate Python for wider use as it
> is the best available language for things like hardware control and
> data acquisition, but the lack of an easy-to-use GUI editor is
> the blocking point.


> I can teach anyone how to create a program for data
> acquisition, but I don't see how more than a few could create a GUI
> without an easy-to-use tool.

Like Tkinter?

> There's still a lot of VB6 code around as there's no replacement and
> this gap could well be filled by Python.

Visual Basic sucks. I spend more time re-focusing my mental energy
than actually getting work done. There is no replacement for pure raw
code. You visualize GUI's in you mind, and fingers bring that vision
to life through properly written API's.

Never invent a new problem for a solution that does not exist.

More information about the Python-list mailing list