How to choose the right GUI toolkit ?

S

Steven D'Aprano

Yeah, okay, I didn't read through the details of the PEP. I picked a bad
example to illustrate a point that is still true. The FAQ also tries to
argue that it's a Good Thing that join() is a string method, not a list
method. It also tries to argue that there's a good reason that lists are
different than tuples. I don't think it would surprising that many
Python developers don't really buy those arguments either.

Well, as far as I'm concerned, you've just blown your credibility
completely out the water now.

Yes, I'm aware that there are many Python programmers who don't get join()
or lists/tuples, but I'm constantly surprised by that fact. At the risk of
starting another argument, to my mind that's like discovering that there
are professional butchers who don't think that using a sharp knife is a
good idea.
 
B

Bjoern Schliessmann

Steven said:
And just for the avoidance of doubt, Python "x == blue or red or
yellow" is semantically equivalent to:

(x == blue) or bool(red) or bool(yellow)

Yep, got it. Shame on me, it's so obvious now :)

Regards,


Björn
 
B

Bill Maxwell

Upon closer look, the walkthrough did say:

***************************
from PythonCard import model

Change that so it says:

from PythonCard import dialog, model

Save the code.
***************************

So, it works.


Thanks for looking into it. It sounds like either it has been fixed in
the newer version -- or I didn't do something correctly. It's been a
long time, and I was just going by the notes I made back then.
 
P

Peter Decker

Nick and John S., thank you for the tip on wxPython! I'll look into it
for my next project. I too would avoid Qt, not because of the GPL but
simply because I don't use KDE under Linux and because Qt is not well
supported under Cygwin or on native Windows. I too like to learn from
actual printed books, so I'll check this one out. O'Reilly should do a
book on Python GUI stuff!

John H.: thanks for pointing out pythoncard. This looks like it might
be an excellent substitute for LabView-like GUIs, which all my
coworkers like. I personally refuse to read or write LabView code, on
the grounds that its syntax causes severe brain damage and is
completely unportable. But that's a flame for another thread, so to
speak...

You should also take a look at Dabo. Like PythonCard, it wraps
wxPython, but it completely does away with the whole getter/setter
approach, the ugly ALL_CAPS_CONSTANTS that wxPython unfortunately
inherited from its C++ roots, and all those other non-Pythonic
irritants. While Dabo is a complete 3-tier framework for developing
database apps, you can just use the GUI tier. I don't do database
stuff, and so I just use the dabo.ui module.

Their URL is http://dabodev.com.
 
S

skip

Steven> The world seems to be flat, the sun appears to rotate around the
Steven> Earth, and mushrooms look like they are more closely related to
Steven> plants than to animals, but none of these things are actually
Steven> the case.

Where can I read about mushrooms as animals?

Skip
 
S

Steven D'Aprano

Steven> The world seems to be flat, the sun appears to rotate around the
Steven> Earth, and mushrooms look like they are more closely related to
Steven> plants than to animals, but none of these things are actually
Steven> the case.

Where can I read about mushrooms as animals?

Mushrooms, like all fungi, aren't animals. The old divide of the
living world into animals and plants has been obsolete in biology for
decades. Biologists today generally follow Woese's "Six Kingdoms":

Eubacteria ("ordinary bacteria")
Archaebacteria ("extrophile bacteria")
Fungi
Plantae (plants)
Animalia (animals)
Protista (eukaryotes that are neither fungi, plants or animals -- a
grab-bag of "things left over" such as protozoa and algae)

Notice that, although to the naked microscope eubacteria and
archaebacteria seem very similar, their biochemistry is radically
different -- more so than (say) an oak tree and you or I.

Based on molecular and DNA evidence, fungi and animals are more similar
than fungi and plants. (Remember that animals include many thousands of
species that don't walk or crawl or fly, beasties like corals, sponges and
other creatures that look superficially plant-like.) Both animals and
fungi rely on plants to convert solar energy into chemical forms that they
can digest.

The best evidence is that the animal kingdom (including, naturally, human
beings) and fungi split during the Mesoproterozoic Era, approximately
1500-2000 million years ago. The common ancestor ("concestor") of animals
and fungi split from plants not long before that, where by "not long" I
of course mean "many hundreds of millions of years".

Richard Dawkins' excellent book "The Ancestor's Tale" is worth reading for
more about this. But keep in mind that biology is in a constant state of
flux these days, with new molecular discoveries virtually every day, so
dates are naturally uncertain and subject to revision. (Aside: this
willingness, even desire, to revise old beliefs in the light of new
evidence disproves the Creationist canard that evolution is a matter of
faith rather than science -- but I digress.)

See also http://en.wikipedia.org/wiki/Fungi for more about fungi including
mushrooms, although regrettably little on their evolutionary relationship
with other species. Follow the references there to discover more.

http://en.wikipedia.org/wiki/Kingdom_(biology) discusses the
biological kingdoms -- again, treat Wikipedia as the start, not the end,
of your reading :)
 
H

Hendrik van Rooyen

8<---------------------------------------------------
... print color, "is red or green or yellow"
...
blue is red or green or yellow

*grin* - this can be construed as a weakness in Python -

Even COBOL compilers in the sixties would "add in" the implied
"if color = " after each 'or', instead of bloody - mindedly thinking:

ok the first condition is not true
the second "condition" 's string is not empty,
so take the true path...

BUT - the other way leads naturally to abominations like:

if color not equal to 'red' or 'green' or 'yellow'....

where 'green' and 'yellow' takes the "wrong" path,
as neither is equal to red, when what you wanted was:

if color not equal to 'red' and 'green' and 'yellow'...

Long live de Morgan!

In this Python simply requires you to be specific in what you want,
which is in a sense a GoodThing, seen as a BadThing by lazy programmers.

And as for the colon : colon schmolon - its irrelevant either way,
but if the interpreter requires it, you have no choice but to type it...

Programming is basically about guessing what was in the mind of the compiler
writer.

- Hendrik
 
R

Ron Adam

Steven said:
Inform 6 "x == blue or red or yellow" is equivalent to the Python

x == blue or x == red or x == yellow

Maybe it should have been expressed as:

x == (blue or red or yellow)


Cheers,
Ron
 
F

Fredrik Lundh

Michael said:
Yeah, okay, I didn't read through the details of the PEP. I picked a bad
example to illustrate a point that is still true. The FAQ also tries to
argue that it's a Good Thing that join() is a string method, not a list
method. It also tries to argue that there's a good reason that lists are
different than tuples. I don't think it would surprising that many
Python developers don't really buy those arguments either.

nice try, troll boy.

</F>
 
F

Fredrik Lundh

Hendrik said:
*grin* - this can be construed as a weakness in Python -

it's boolean logic, and it's incompatible with human use of the same
terms in all contexts, not just Python.

</F>
 
A

Antoon Pardon

Well, as far as I'm concerned, you've just blown your credibility
completely out the water now.

Yes, I'm aware that there are many Python programmers who don't get join()
or lists/tuples, but I'm constantly surprised by that fact. At the risk of
starting another argument, to my mind that's like discovering that there
are professional butchers who don't think that using a sharp knife is a
good idea.

Well I would think that if you would find out that many professional
butchers would think so, you might consider the idea has some merrit.
 
S

Steven D'Aprano

Maybe it should have been expressed as:

x == (blue or red or yellow)


But that has very different semantics still -- since parentheses have the
highest priority, it means "evaluate (blue or red or yellow), then test if
x is equal to the result".

It might be useful on occasion to have a construct for "x equals blue or
red or yellow" in the sense used by normal English or Inform 6. And,
funnily enough, Python has such a construct. You just have to write "in"
instead of ==, and use a tuple for the terms:

x in (blue, red, yellow)

Not hard to remember, and unambiguous.
 
F

Florian Diesch

Dan Lenski said:
So, is there another toolkit I should be looking at? Having something
that can run easily on Cygwin and native Windows is a priority so that
I can quickly move programs to new measurement computers. I like GTK a
lot and Tk is growing on me too.. are there any higher-level "wrapper"
toolkits for GTK and Tk?

For Gtk there's Kiwi <http://www.async.com.br/projects/kiwi/>



Florian
 
R

Ron Adam

Steven said:
But that has very different semantics still -- since parentheses have the
highest priority, it means "evaluate (blue or red or yellow), then test if
x is equal to the result".

It might be useful on occasion to have a construct for "x equals blue or
red or yellow" in the sense used by normal English or Inform 6. And,
funnily enough, Python has such a construct. You just have to write "in"
instead of ==, and use a tuple for the terms:

x in (blue, red, yellow)

Not hard to remember, and unambiguous.

Yes, that is the correct best way to do it, of course.

Funny thing is I tested a variation of the above version in a console and it
seemed to work, which surprised me. Now I can't get it to work, <scratching
head>. I don't know exactly what I typed in last night, so I can't figure out
what subtle (or overlooked obvious) characteristics my test had which gave me
the misleading results.

Sigh. I did think it was kind of odd it (apparently) worked, which was why I
phrased it as a suggestion.

Cheers,
Ron
 
J

John Henry

BTW: I did a search and found the testnotebook example from:

http://prdownloads.sourceforge.net/pythoncard/testNotebook.zip?download

and tried it out. There is one error in the widget.py that I have to
get around. Changed from:

canvas.setFillColor('gray')

to:

try:
canvas.setFillColor('gray')
except:
pass

and then ran it. Works!

So, yes, you can do Notebook in Python. I believe what they are saying
is that Notebook isn't supported fully (yet) in the resourceeditor.
 
R

Ron Adam

Georg said:
Special cases aren't special enough to break the rules.

Georg

A bit of a circular answer.

Why the rule? -> So not to break the rule?


I would guess this probably is more applicable in this case.

Explicit is better than implicit.


Ron
 
G

Georg Brandl

Ron said:
A bit of a circular answer.

Why the rule? -> So not to break the rule?

You proposed to allow leaving off line continuation '\' only in the
"if", "for" and "while" headers. This is a special case in my eyes.
I would guess this probably is more applicable in this case.

Explicit is better than implicit.

Of course, this always applies :)

Georg
 
R

Ron Adam

Georg said:
You proposed to allow leaving off line continuation '\' only in the
"if", "for" and "while" headers. This is a special case in my eyes.

I wasn't that specific and it was related to Michael's suggestion the colon
wasn't needed. If the need for '\' was dropped in multi-line block headers, then
the colon would be required for an obvious reason.

If the requirement for line continuations was omitted for "any" block header
starting with a python keyword and ending with a colon, would it still be a
special case? It would be a bit less explicit. Are there situations where you
would want to explicitly limit a block header to just a single line because of
some negative consequence?

I'm asking more for just plain curiosity, and not suggesting this actually be
changed. In practice I don't think its enough of a issue to warrant changing in
python 2.x. Although it just may (coin toss here) be beneficial for python 3k
if extended annotations are implemented.

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top