[Code Challenge] WxPython versus Tkinter.

O

Octavian Rasnita

From: "rantingrick" <[email protected]>
For something as common as displaying a file browser, it should be as
simple as this:
import gui_toolkit # whichever
path = gui_toolkit.select_file()
Something like zenity:
[steve@sylar ~]$ zenity --file-selection
/home/steve/python/findsingle.py

And indeed, it is that simple:

python -c "import tkFileDialog as tkfd;print tkfd.askopenfilename()"


Martin the tkFileDialog.ask* uses the platform specific Open, Save
dialogs which DO contain a ListCtrl. Obviously this ListCtrl is not
available to Tkinter uses. You just exposed your weak knowledge of
Tkinter and sadly you are very high on the community totem pole. Very
sad :(




Aha, that's why that Open File window was accessible for JAWS screen reader,
although it uses Tk... because actually it doesn't use Tk.

Octavian
 
N

Noah Hall

So far only trolls (besides Terry, Octavian, D'Aprano) have replied.
In my time here within the Python community i have only met one person
who shares my in-depth knowledge of Tkinter. That person is Kevin
Waltzer. So outside of Python-dev and Guido. Kevin and I are are the
ONLY people qualified to offer opinions on the worth or worthlessness
of Tkinter. If anyone in this entire community thinks that they also
are qualified then prove your worth by creating a ListCtrl in Tkinter
that mirrors the wxPython ListCtrl in functionality. When you have
done that, i will elevate you to my circle of enlightenment. Than and
only then shall i even entertain you BS.


Wow, someone's certainly feeling very self-important, ignoring the
fact he can't follow conventions nor write cross-platform software.
And before you start, no, I don't want to steal your "file browser".
 
M

Martin v. Loewis

Well i did "expect" that you would at least include some info as to
your OS and version.

OS is Linux, wxPython is Debian python-wxgtk2.6 2.6.3.2.2-5+b1.
That would be helpful also. Obviously the
wx.ImageList is barfing. Do you have the Bitmap folder containing the
three images. Did you try to comment out the "_createImages()" line.

If I do, I get

Traceback (most recent call last):
File "wxtk_challenge_1.py", line 222, in <module>
frame = AppFrame()
File "wxtk_challenge_1.py", line 206, in __init__
self.listWidget.showDirectory(sys.prefix)
File "wxtk_challenge_1.py", line 150, in showDirectory
imageIdx = self.imageMap[iconname]
KeyError: 'folder'

If I then also comment out lines 150..154, I get a window, but it's
empty (of course).
Simple debug skills we are talking about here Martin, simple. But yet
again this is only tested on Windows. I clearly noted that in the
source.

Well Rick, this doesn't make look wxPython any better.

Regards,
Martin
 
B

Bryan

So far only trolls (besides Terry, Octavian, D'Aprano) have replied.
In my time here within the Python community i have only met one person
who shares my in-depth knowledge of Tkinter. That person is Kevin
Waltzer. So outside of Python-dev and Guido. Kevin and I are are the
ONLY people qualified to offer opinions on the worth or worthlessness
of Tkinter. If anyone in this entire community thinks that they also
are qualified then prove your worth by creating a ListCtrl in Tkinter
that mirrors the wxPython ListCtrl in functionality. When you have
done that, i will elevate you to my circle of enlightenment. Than and
only then shall i even entertain you BS.

Until then, anyone who tries to devalue my argument is just an
ignorant troll.

I think I'm qualified, though I guess only you can tell me if I
measure up to your standards. I have 15 years or so of tk development,
though admittedly mostly with Tcl. Most recently I've spent about the
past year and a half with wxPython. For what it's worth, I am the only
person on stackoverflow.com with the "tkinter" badge, which only means
I've answered a bunch of questions on tkinter that others find
helpful, nothing more.

No offense, but your challenge is worthless, and your own entry in the
challenge is remarkably weak. About the only thing you've proven is
that wxPython has some built-in widgets that tkinter does not have,
and that wxPython makes it hard to do cross-platform development. Does
that surprise anyone? I'll give you a challenge: create a vector
graphics program. wxPython doesn't have anything that can compare to
the ease of use and power of tkinter's canvas. What does that prove?
Only that tkinter has widgets wxPython does not. I don't think that
will come as news to anyone. I could easily come up with other
challenges where tkinter shines and wxPython falls flat on its face,
but that proves nothing.

What's really amusing is that your program segfaults on linux yet is
supposed to show wxPython superiority. In my 15-20 years of tk
development, you know how many segfaults I've seen? Approximately
zero. Maybe there was one or two there somewhere, I don't know for
certain. wxPython? It segfaults on me on a weekly basis (literally,
thats not hyperbole). Which is the better toolkit? Fortunately for
wxPython, the segfaults are mostly due to coding errors (typically,
for lack of documentation). For the most part they don't happen once I
release the code.

All your challenges are going to prove is what we already know: both
toolkits have strengths and weaknesses, and neither is perfect. I'll
choose the tkinter binding event handling over wxPython any day of the
week and twice on Sundays. It is _clearly_ and _by_far_ superior in
every way. In fact, of the dozen or so toolkits I've used extensively
over the last 20+ years, nothing comes close to the power of tkinter
bindtags.

The same can be said about tkinter's pack, place and grid geometry
managers over wxPython's sizers. Tkinter wins _hands_down_. Easily.
Not even close. Does that make tkinter better? No, just easier to use
to do layout. Ultimately you can do pretty much the same thing with
wxPython, just with more (and, arguably, less readable) code.

On the other hand, wxPython clearly has more widgets. Some are very
useful for very common tasks, such as file and image browsers.
wxPython has the nice ability to draw on top of any widget, and the
aui library shows a lot of promise. I spend a little less of my time
"rolling my own" with wxPython.

If you're doing a programmers editor it's hard to beat (and hard to
program!) the styledtextctrl available with wxPython. It has features
unique to coding editors that the tkinter text editor does not. That
being said, the tkinter text editor is a marvel of simplicity and
power. A project I'm doing now with a very specialized editor would be
orders of magnitude easier to do with tkinter's text widget.

So, all you've proven is that wxPython has different widgets than
tkinter, and that it's hard to create a cross-platform GUI that looks
nice in wxPython. It would be hard (but not impossible, by any
stretch) for me to duplicate your code. Certainly, it would take more
lines of code but that's about it. OTOH, it would be very difficult
indeed to create a tkinter program that works on windows but segfaults
on linux. That's also quite hard in tkinter.

Frankly, I think a set of real-world challenges for all toolkits would
be useful. The problem is, you have no intention of staging a fair
fight. Your very first choice was to tie the hands of tkinter behind
its back, so it's hard to take your challenge seriously. If you're
serious, you'll find a disinterested third party and ask them to come
up with a handful of use cases for testing toolkits, without giving
them knowledge of which toolkits you intend to test. Anything less
will be just a bunch of grandstanding.
 
R

rantingrick

When I run the code snippet Martin provided under Linux, the file
selection box shows files in columns. That's part of the reason why I
consider it ugly -- I'm an old Mac guy, and I still dislike file
selection tools that use the Windows 95 style 2-D layout:

a-file      e-file      ...
b-file      f-file      y-file
c-file      g-file      z-file
d-file      h-file

instead of a simple vertical list:

a-file
b-file
c-file
...
z-file

Call me a dinosaur if you will, but I hate horizontal scrolling.


Oh gawd Steven i hope you are just playing devils advocate here
because now you are just being completely ridiculous. And if you want
to see the list in vertical mode push the "Reportveiw" button. Wait,
you *really* are a dinosaur!
 
R

rantingrick

Well Rick, this doesn't make look wxPython any better.

Well Martin this seems to be a Linux problem. And it may be a debian
problem. Every Google search i landed on with wxPython+imagelist
+sefault the user mentioned "debian"...hmm?. Has anybody tested this
on Unbuntu? And if it segfaults on Ubuntu that just means you Linux
guys need to do some debugging and offer a solution instead of
pointing fingers. Linux OS is not a hand holding OS so stop your belly
aching.

All you guys know damn good and we can make wxPython completely cross
platform. However the fact is that you DO NOT want to consider
wxPython so you're NOT going to actually put forth some solutions.
This thread has been an eye opener for myself and many people in the
fact that this community has both lost vision and the apathy is so
demoralizing that we cannot even work together to get some simple code
debugged. The spirit of community, and each helping one another, does
not exists!

Congratulations python community, you have failed yourself! :(
 
B

Bryan

Dammit! There goes my brilliant idea for getting rich.

Step 1: Start company.
Step 2: Steal working file browser from Internet.
Step 4: Profit!

I think rantingrick's comment inadvertently shows in a nutshell
everything wrong with this thread and why there is so little interest in
his proposal. If RR is right about the GUI toolkit making or breaking the
entire Python community, there should be hundreds of people with an
opinion, not just a handful.

(1) rantingrick is willing to spend *hours* brow-beating people,
insulting them, and cajoling them into doing things *his* way, supposedly
because of his deep concern for the Python community, but isn't willing
to donate a lousy *file browser* to the community.

(2) GUI programming is TOO DAMN HARD, and until that fact is addressed,
it's difficult for the majority of people to care whether the toolkit
used (or, more likely, not used at all) is Tkinter, or wxPython, or
something else.

For something as common as displaying a file browser, it should be as
simple as this:

import gui_toolkit  # whichever
path = gui_toolkit.select_file()
You mean like:
[<open file '/Users/bryan/Documents/1.gif', mode 'r' at 0x5bf50>]

:)

(I think the actual point of contention isn't a file dialog, but a
file browser like the windows explorer.
 
B

Bryan

The only way i can respond to this is to quite the requirements for my
challenge...

So, what you're saying is, the real challenge you are presenting is
"using the toolkit of your choice, open up a wx.ListCtrl widget".

If you want a fair challenge don't say "you can't use widget X". All
you're trying to prove is that tkinter doesn't have a wx.ListCtrl
widget. I think most people can agree with you on that point.
 
B

Bryan

Well wxPython ha a treectrl too. And if we were comparing apples to
apples then we would compare the wx.TreeCtrl to the Tk::TreeCtrl.
However there are many things that a ListCtrl can do that a treectrl
can't. The biggest difference.... COLUMNS


I am not handicapping TclTk. They already did that themselves by
refusing to keep up with  21st century GUI libraries. Sure, you can
say Tkinter is a knife and wxPython is an AK47 but who's to blame when
you bring a knife to gun fight Kevin? Switch to wx and enjoy the
bloodbath.

"switch to wx and enjoy the bloodbath"

That has *got* to be quote-of-the-week material. Sometimes when I've
spent a day wrestling with wxPython I do indeed feel like I've been in
a bloodbath!

(I'm not picking on wxPython per se -- it's what I'm using for my
current project -- just that the analogy was perhaps a bit more on
target than rantingrick intended :)
 
R

rantingrick

So, what you're saying is, the real challenge you are presenting is
"using the toolkit of your choice, open up a wx.ListCtrl widget".

read the very first post which outlines the challenge.
If you want a fair challenge don't say "you can't use widget X". All
you're trying to prove is that tkinter doesn't have a wx.ListCtrl
widget. I think most people can agree with you on that point.

Bryan you are clearly an idiot. I am demanding that from now on, you
must have at least a 120 or higher IQ before participating in any of
my threads. Really, if you are an idiot then you should not be allowed
to vote or reproduce. However for this group i may have set the bar
too high!
 
B

Bryan

Of course as Steven pointed out wx is written in C++ which is almost
certainly where the crash is occurring.
But this is technical nitpicking.
The real issue is that when coding in C/C++ segfaults are a daily
affair.
Whereas for python its the first time I am seeing it in 10 years...

In my experience, segfaults with wxPython aren't daily, but they are
pretty much weekly. There are weeks that can go by without them, but
then I'll have several in a week to bump up the average.

wxPython is fairly sensitive to coding mistakes, and the documentation
is sufficiently weak that it's easy to make coding mistakes. There are
a lot of things you can do that aren't valid in particular contexts,
and instead of throwing a catchable error you get a segfault. Plus, as
we've seen, it's platform specific. So it's easy to create code that
works great on one platform even with some bad code in it, and that
same code will segfault on another platform.

This shouldn't be enough to keep you from using wxPython, it just
means you have to be a bit more diligent and you can't assume that
your linux code will work on windows or visa versa without testing.
tkinter seems far less susceptible to that. Mostly with tkinter the
platform issues are true platform issues (font availability, file
paths, etc).
 
O

Octavian Rasnita

From: "Bryan said:
It would be hard (but not impossible, by any
stretch) for me to duplicate your code. Certainly, it would take more
lines of code but that's about it. OTOH, it would be very difficult
indeed to create a tkinter program that works on windows but segfaults
on linux. That's also quite hard in tkinter.


I doubt you could do a program that offers the same features using Tkinter.
That program will not be accessible for screen readers and this is a big
problem, a vital problem for those that use a screen reader, because the
program won't be accessible at all.

Octavian
 
P

Peter Otten

rantingrick said:
I am demanding that from now on, you
must have at least a 120 or higher IQ before participating in any of
my threads.

You mean, you are putting yourself in your own killfile ;)
 
R

rantingrick

In my experience, segfaults with wxPython aren't daily, but they are
pretty much weekly.
hmm

There are weeks that can go by without them, but
then I'll have several in a week to bump up the average.

Yes, and this could not be your problem, it must be wxPython. Right?
*rolls-eyes*

wxPython is fairly sensitive to coding mistakes,

Oh so now we get the picture...
and the documentation
is sufficiently weak that it's easy to make coding mistakes.

That is somewhat true.

There are
a lot of things you can do that aren't valid in particular contexts,
and instead of throwing a catchable error you get a segfault.

And we need to fix that instead just disqualifying a feature rich
toolkit.
Plus, as
we've seen, it's platform specific. So it's easy to create code that
works great on one platform even with some bad code in it, and that
same code will segfault on another platform.

Again, were is the community spirit. I have windows and you have
linux. Let's write some code and do cross testing and then fix the
bugs.
This shouldn't be enough to keep you from using wxPython, it just
means you have to be a bit more diligent and you can't assume that
your linux code will work on windows or visa versa without testing.

Thank you!
tkinter seems far less susceptible to that. Mostly with tkinter the
platform issues are true platform issues (font availability, file
paths, etc).

Yes because Tkinter is lacking. Because Tkinter is not even half the
library that wx is.
 
G

Giampaolo Rodolà

2011/1/24 rantingrick said:
Well Martin this seems to be a Linux problem. And it may be a debian
problem. Every Google search i landed on with wxPython+imagelist
+sefault the user mentioned "debian"...hmm?. Has anybody tested this
on Unbuntu? And if it segfaults on Ubuntu that just means you Linux
guys need to do some debugging and offer a solution instead of
pointing fingers. Linux OS is not a hand holding OS so stop your belly
aching.

All you guys know damn good and we can make wxPython completely cross
platform. However the fact is that you DO NOT want to consider
wxPython so you're NOT going to actually put forth some solutions.
This thread has been an eye opener for myself and many people in the
fact that this community has both lost vision and the apathy is so
demoralizing that we cannot even work together to get some simple code
debugged. The spirit of community, and each helping one another, does
not exists!

Congratulations python community, you have failed yourself! :(

This is nonsense and you are clearly a troll. =)


--- Giampaolo Rodolà
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/
 
K

Kevin Walzer

Well, I have also tested the program dirbrowser.py, but it is not decent
at all.
I have tested it with JAWS screen reader and it is absolutely inaccessible.

The single "accessible" things in it are the title bar which is "tk".
It can't compare with the same program made using WxPython.
And it can't be made to be more accessible than it is, because it uses Tk.

So Tkinter is really bad.

If accessibility leads your criteria, then yes, Tk may be deficient. I
can't speak to this on other platforms or with other toolkits.
 
K

Kevin Walzer

Bryan you are clearly an idiot. I am demanding that from now on, you
must have at least a 120 or higher IQ before participating in any of
my threads. Really, if you are an idiot then you should not be allowed
to vote or reproduce. However for this group i may have set the bar
too high!

Rick,

I've tried to give you the benefit of the doubt during this discussion,
but I've had enough. Bryan Oakley is no idiot. You said elsewhere in
this thread that my expertise with Tkinter was worth something, but
Bryan's is worth far more. He is one of the foremost Tcl/Tk developers
alive, author of many widely-used Tk widgets, and a long-term helpful
presence on comp.lang.tcl. He's patiently answered many inflammatory
questions from inexperienced or arrogant developers, and I've learned a
tremendous amount from him. Job circumstances forced him to move into
Python development a few years ago, and he now uses wxPython on a daily
basis, while being active on Stack Overflow and elsewhere with answering
questions about Tkinter. In short, I'd have a hard time imagining
anyone more qualified to compare wxPython and Tkinter than Bryan Oakley.

Also, it's not helpful for you to respond to people who disagree with
you with this kind of name-calling. It certainly does not earn any
respect for your arguments.

--Kevin
 
R

rantingrick

I think I'm qualified, though I guess only you can tell me if I
measure up to your standards.

Go on...
I have 15 years or so of tk development,
though admittedly mostly with Tcl. Most recently I've spent about the
past year and a half with wxPython.

A year and a half and you are still producing buggy code? (you
yourself admitted this!)
For what it's worth, I am the only
person on stackoverflow.com with the "tkinter" badge, which only means
I've answered a bunch of questions on tkinter that others find
helpful, nothing more.

Well could we see a link to a few answered questions or get your nick
so we can corroborate this statement ourselves?
No offense, but your challenge is worthless, and your own entry in the
challenge is remarkably weak.

First rule when given a challenge you cannot answer due to ignorance:
question the validity of the challenge.
About the only thing you've proven is
that wxPython has some built-in widgets that tkinter does not have,

Well this is ONLY the first challenge Bryan. More will come. However,
not until someone has the balls to answer my first challenge.
and that wxPython makes it hard to do cross-platform development.

I don't think that is completely accurate Bryan. Harder than Tkinter,
yes. Anything else is hyperbole.
Does
that surprise anyone? I'll give you a challenge: create a vector
graphics program.

Answer my challenge first, then we talk. And obviously you do not
understand the power of wx's Open Graphics Library (OGL). You'd better
go check that out before you stick your Tkinter loving foot into your
big mouth.
wxPython doesn't have anything that can compare to
the ease of use and power of tkinter's canvas.

Thats more uninformed BS. You are really hurting your public image
here bryan!
What does that prove?
Only that tkinter has widgets wxPython does not. I don't think that
will come as news to anyone. I could easily come up with other
challenges where tkinter shines and wxPython falls flat on its face,

And these challenges are what? You see when you make empty challenges
like this you look dumb.
What's really amusing is that your program segfaults on linux yet is
supposed to show wxPython superiority.

Segfault or not wx is superior.
In my 15-20 years of tk
development, you know how many segfaults I've seen? Approximately
zero.
BULLSHITE!

Maybe there was one or two there somewhere,

Ah yes, the old conscience catches up fast to the habitual liars.
I don't know for
certain.

Finally some truth!
wxPython? It segfaults on me on a weekly basis (literally,
thats not hyperbole).

LIAR! LIAR! PANTS ON FIRE!
------------bryan-------------
In my experience, segfaults with wxPython aren't daily, but they are
pretty much weekly. There are weeks that can go by without them
------------bryan-------------
Which is the better toolkit? Fortunately for
wxPython, the segfaults are mostly due to coding errors

Yea, ya think?
For the most part they don't happen once I
release the code.

And yet you cannot offer a solution for this segfault. Interesting.
All your challenges are going to prove is what we already know: both
toolkits have strengths and weaknesses, and neither is perfect.

And sadly that IS ALL you know. More fruits must be weighed in this
decision. Like the fact that Tkinter is legacy and wxPython is current
technology.
I'll
choose the tkinter binding event handling over wxPython any day of the
week and twice on Sundays.

So will i. We should change the wxPython API!
It is _clearly_ and _by_far_ superior in
every way.

True. We should change the wxPython API!
In fact, of the dozen or so toolkits I've used extensively
over the last 20+ years, nothing comes close to the power of tkinter
bindtags.

*yawn*. Guido's advocate!
The same can be said about tkinter's pack, place and grid geometry
managers over wxPython's sizers.

Agreed! We should change the wxPython API!
Does that make tkinter better? No, just easier to use
to do layout.

Agreed! Because if we were really smart we would just change the
wxPython API so that we have the simplicity of Tkinter and the feature
richness of wxPython. See wax for ideas...

http://wiki.wxpython.org/Wax
Ultimately you can do pretty much the same thing with
wxPython, just with more (and, arguably, less readable) code.

Wrong. You can do much much more with wxPython. The ugliness of the
code depends on the coders ability to create good or bad code.
On the other hand, wxPython clearly has more widgets. Some are very
useful for very common tasks, such as file and image browsers.

and spreadsheets, and validated input, and multi-choice directory
choosing, and multi choice lists, and Rich Text, and book controls,
and Calendars, and Toolbars, and full image support, and masked edit
controls, and scrolled panels, and styled text, and print support, and
listctrl, and virtual listctrl and editable list ctrl, and REAL
DND ,and GC, and GLCanvas, and JoyStick, and OGL, and shaped windows,
and more, more, more...
wxPython has the nice ability to draw on top of any widget, and the
aui library shows a lot of promise. I spend a little less of my time
"rolling my own" with wxPython.

You will always spend less time rolling in wxPython.
If you're doing a programmers editor it's hard to beat (and hard to
program!) the styledtextctrl available with wxPython. It has features
unique to coding editors that the tkinter text editor does not. That
being said, the tkinter text editor is a marvel of simplicity and
power. A project I'm doing now with a very specialized editor would be
orders of magnitude easier to do with tkinter's text widget.

Which do you want, simplistic confinement or expansive elegance. You
can't have both. And besides. One could easily create a simplistic
"Tkinter like" textbox API using wxPython. You lack vision Bryan. We
can bring all this into reality!
It would be hard (but not impossible, by any
stretch) for me to duplicate your code.

PUT UP OR SHUT THE HELL UP!
 
L

Littlefield, Tyler

Or you have started to use Linux and now you don't care about the
majority of >users that need to use a screen reader?
I said nothing the like. TkInter does have problemns with Jaws, but I'm
not going to sit here and say the same thing over and over as you are
doing. Get off the soapbox already.
 
R

rantingrick

Rick,

I've tried to give you the benefit of the doubt during this discussion,
but I've had enough. Bryan Oakley is no idiot.

He is obviously lying to discredit me. And I have posted evidence of
his hyperbole.
You said elsewhere in
this thread that my expertise with Tkinter was worth something, but
Bryan's is worth far more. He is one of the foremost Tcl/Tk developers
alive, author of many widely-used Tk widgets, and a long-term helpful
presence on comp.lang.tcl. He's patiently answered many inflammatory
questions from inexperienced or arrogant developers, and I've learned a
tremendous amount from him. Job circumstances forced him to move into
Python development a few years ago, and he now uses wxPython on a daily
basis, while being active on Stack Overflow and elsewhere with answering
questions about Tkinter.  In short, I'd have a hard time imagining
anyone more qualified to compare wxPython and Tkinter than Bryan Oakley.

Yet he has NO knowledge of wxPython and his Tkinter knowledge is
lacking.
Also, it's not helpful for you to respond to people who disagree with
you with this kind of name-calling. It certainly does not earn any
respect for your arguments.

Well i agree with that. However these people keep coming back with the
same BS arguments...

* the challenge is impossible.

No the challenge is not impossible to complete. However due to
Tkinters lacking richness. It is impossible to win against wxPython.
So they resort to all this BS because they KNOW they cannot win. Just
admit that wxPython wins this round and i'll move on to the next
challenge.

* wxPython is not cross platform.

Total BS.

* Yes wxPython has many widgets but most are not useful.

Even more BS.

And you wonder why i call people ignorant? I did give them the benefit
of the doubt before saying these things. Bryan has yet to post any
links so i can corroborate his "Tkinter" guru status. He has also
clearly lied many times in his posts (which i have documented). And
most importantly no one but myself has offered any code.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top