GUIs - A Modest Proposal

rantingrick rantingrick at gmail.com
Mon Jun 14 13:57:46 EDT 2010


On Jun 14, 11:17 am, Stephen Hansen <me+list/pyt... at ixokai.io> wrote:
> And the recursive flow of the DOM is powerful

This style of speaking reminds me of our former hillbilly president
(no not Clinton, he was the eloquent hillbilly!) No i am referring to
good old "George Dubya". He left us with so many juicy sound bites....

HOST: I’m curious, have you ever googled anybody? Do you use Google?
BUSH: Occasionally. One of the things I’ve used on the Google is to
pull up maps. It’s very interesting to see — I’ve forgot the name of
the program — but you get the satellite, and you can — like, I kinda
like to look at the ranch. It remind me of where I wanna be sometimes.

... Thanks Dubya for making a complete moron of yourself, AGAIN!

> (and in some cases,
> superbly suited to a task), but I maintain fully: at no point is it
> easy, simple, or even entirely comprehensible to most average geeks.
> Traditional GUI models vs the web layout model are just alien to one
> another, and the latter is -extremely- convoluted.

I'll have to very much agree with this assessment Stephan. There
exists not elegant API for these "web" UI's. The people over at
SketchUp (my second love after python) have this problem on a daily
bases with WebDialogs. Even the javascript gurus have a dificult time
juggling javascript, CSS, and Ruby code to make these grumpy beasts
come to life, and when they do it ain't really pretty. Many have
lamented for a simple to use GUI like Tkinter or even Wx but our cries
have fallen on deaf ears.

But digging a bit deeper you can think of the javascript/css/
langugageX here as the same mind warping power C/C++ hold over it's
users too. Low level C hackers cannot properly use a high level
language like Python (with some very small exceptions). I see it all
the time in the SketchUp Ruby API. These guys are like fish out of
water when you give them a Python/Ruby interpretor. Here is a "nutty"
example....

# UI.inputbox(prompts, defaults, enums, title) -> result
# With four params, it shows a drop down box for prompts that have
# pipe-delimited lists of options. In this case, the Gender prompt
# is a drop down instead of a text box.
prompts = ["What is your Name?", "What is your Age?", "Gender"]
defaults = ["Enter name", "", "Male"]
list = ["", "", "Male|Female"]
input = UI.inputbox prompts, defaults, list, "Tell me about yourself."

...Does it need to be that messy, well in the C world yes, but in
Python/Ruby world lets make our lives easier shall we...

input = UI.inputbox(
    'Title Here',
    'prompt1=default1'
    'prompt2=default2',
    'prompt3=opt1|opt2',
    )

... now i feel the same bliss old George knows all to well and
ignorance has nothing to do with it ;-).

> wx uses a complicated recursive layout engine (unless you're mildly nuts
> and try to do absolute layouts) which in all essence does *exactly* what
> you are describing there. With a little bit of boiler plate: you have to
> declare a certain box to be allowed to grow a scrollbar, so that's a
> little more work. But less in others: I never have to resort to resize
> hooks to get stuff to reconfigure itself (with the sole exception being
> the Expandable Text Control).

I must say of all the GUI's Tkinter does handle geometry management in
a most simplistic way. You have your choice between three managers
grid, pack, and place. Wx introduces a little less elegance however
nothing like what we have here.




More information about the Python-list mailing list