21

I recently did some work modifying a Python gui app that was using wxPython widgets. I've experimented with Python in fits and starts over last six or seven years, but this was the first time I did any work with a gui. I was pretty disappointed at what seems to be the current state of gui programming with Python. I like the Python language itself a lot, it's a fun change from the Delphi/ObjectPascal programming I'm used to, definitely a big productivity increase for general purpose programming tasks. I'd like to move to Python for everything.

But wxPython is a huge step backwards from something like Delphi's VCL or .NET's WinForms. While Python itself offers nice productivity gains from generally programming a higher level of abstraction, wxPython is used at a way lower level of abstraction than the VCL. For example, I wasted a lot fo time trying to get a wxPython list object to behave the way I wanted it to. Just to add sortable columns involved several code-intensive steps, one to create and maintain a shadow-data-structure that provided the actual sort order, another to make it possible to show graphic-sort-direction-triangles in the column header, and there were a couple more I don't remember. All of these error prone steps could be accomplished simply by setting a property value using my Delphi grid component.

My conclusion: while Python provides big productivity gains by raising level of abstraction for a lot of general purpose coding, wxPython is several levels of abstraction lower than the gui tools available for Delphi. Net result: gui programming with Delphi is way faster than gui programming with Python, and the resulting ui with Delphi is still more polished and full-featured. It doesn't seem to me like it's exaggerating to say that Delphi gui programming was more advanced back in 1995 than python gui programming with wxPython is in 2009.

I did some investigating of other python gui frameworks and it didn't look like any were substantially better than wxPython. I also did some minimal investigation of gui formbuilders for wxPython, which would have made things a little bit better. But by most reports those solutions are buggy and even a great formbuilder wouldn't address my main complaints about wxPython, which are simply that it has fewer features and generally requires you to do gui programming at a much lower level of abstraction than I'm used to with Delphi's VCL. Some quick investigating into suggested python gui-dev solutions ( http://wiki.python.org/moin/GuiProgramming ) is honestly somewhat depressing for someone used to Delphi or .NET.

Finally, I've got a couple of questions.

First, am I missing something? Is there some gui-development solution for Python that can compare with VCL or WinForms programming? I don't necessarily care if it doesn't quite measure up to Delphi's VCL. I'm just looking for something that's in the same league.

Second, could IronPython be the direction to go? I've mostly tried to avoid drinking the .NET koolaid, but maybe IronPython gives me a reason to finally give in. Even then, does IronPython fully integrate with WinForms, or would I need to have the forms themselves be backed by c# or vb.net? It looks to me like that definitely is the case with SharpDevelop and MonoDevelop (i.e, IronPython can't be used to do design-time gui building). Does VS.NET fully integrate IronPython with gui-building?

It really seems to me like Python could "take over the world" in a way similar to the way that Visual Basic did back in the early 1990's, if some wonderful new gui-building solution came out for Python. Only this time with Python we'd have a whole new paradigm of fast, cross platform, and open source gui programming. Wouldn't corporations eat that up? Yeah, I know, web apps are the main focus of things these days, so a great Python-gui solution wouldn't create same revolution that VB once did. But I don't see gui programming disappearing and I'd like a nice modern, open source, high level solution.

5
  • Is this a duplicate of stackoverflow.com/questions/35922/… ? Commented Apr 1, 2009 at 22:03
  • Not sure. I did see quite a few related posts, but none which answered my questions directly. I always wonder whether I'm missing something when someone suggests a good solution for gui programming in python. Most of them seem severely lacking compared to what I'm used to. Commented Apr 1, 2009 at 22:08
  • -1: a lot of complaints and rhetorical questions. Focus or something tangible might help. Commented Apr 2, 2009 at 1:14
  • -1: as well. Doesn't look like any real research was done. This post is just a complaint... Commented Apr 2, 2009 at 1:57
  • This may not be relevant, but wxPython has grown some more-fully-featured controls in recent years; some of those ListCtrl problems might (or might not) have been solvable by replacing with a newer/better control. But docs tend to be lacking... I agree that it should be easier than it is. Commented Apr 2, 2009 at 23:27

9 Answers 9

11

seems your complains are about wxPython, not about Python itself. try pyQt (or is it qtPython?)

but, both wxPython and pyQt are just Python bindings to a C / C++ (respectively) library, it's just as (conceptually) low level as the originals.

but, Qt is far superior to wx

Sign up to request clarification or add additional context in comments.

2 Comments

I agree; PyQt is much less clunky than wxWidgets.
QT is awesome, much prefer it over wx
4

PyQt is a binding to Qt SDK from Nokia, and PyQt itself is delivered by a company called RiverBank.

If licence is not important for you you can use PyQt under GPL or you 'll pay some money for commercial licence.

PyQt is binding Qt 4.4 right now.

Qt is not just GUI, it's a complete C/C++ SDK that help with networking, xml, media, db and other stuff, and PyQt transfer all this to python.

With PyQt you'll use Qt Designer and you 'll transfer the .ui file to .py file by a simple command line.

You 'll find many resources on the web about PyQt and good support from different communities, and even published books on PyQt.

Many suggestions consider that RiverBank has no choice but to release the next version which 'll depend on Qt 4.5 under LGPL, we are waiting :).

Another solution is Jython with Java Swing, very easy and elegant to write (specially under JDK 6), but not enough resources on internet.

Comments

3

You may want to look at Jython (Python on the Java VM). It is very similar to Iron Python, and you can fore go the .Net koolaid.

Comments

3

dabo puts wxPython programming at a higher level like what you're looking for.

Comments

2

You're probably going to have to use the .net or java pythons, but check this out first and see if it meets your requirements:

Kiwi

1 Comment

please fix the link, it's broken
2

Short answer: Don't try Tkinter - it's got all the problems described above.

Long answer: Tkinter is not useful for large programs. Handling the various pieces with it somehow invariably degenerates to juggling (which never happens otherwise) and the resulting output doesn't look native or particularly polished.

3 Comments

I don't have extensive experience with Tkinter, but what I have done (along with a few forays into Perl-Tk) strongly supports the idea that Tk (in whatever form) is dandy for doing a slap-dash simple UI quickly, but that trying to do anything at all complex quickly becomes a struggle.
Guido knows what he's doing. If tkinter is shipped with python, there's a reason for it.
tkinter compared to Delphi VCL loses (even the tkinter world champion cannot be as productive as a average Delphi developer on - as an example - prootyping a GUI app). I agree with ehdv, tkinter is low level, it is shipped with python because it allows to use the canvas i think, not for sure to design GUi apps.
0

You are right, wxPython can definetely be improved. But i think Robin Dunn has done a great job so far, and still is.

Especially the wxPython community is open to improvements, like recent inclusion of the widgets by Andrea, so like many community projects pick the one you like most, and improve it while using it.

2 Comments

It's been years since I've used wxPython, but Robin Dunn is awesome - spends huge amounts of time supporting wx as well as developing it, is very friendly & helpful, and has drastically reduced the impedance mismatch beween wxWidgets & Python. Sadly, even as the mismatch shrinks, ... (cont.)
... it becomes more problematic by comparison with other GUI kits. I approve of Robin keeping wxPython as a thin wrapper over wxWidgets, but it is more like writing a GUI in C++ instead of Python... A drag-n-drop builder would be a great help - I wonder what happened to Boa Constructor?
0

We've been quite happy using Python.Net to build our UIs in WinForms and using CPython for Presenter, Model. IronPython is also a good tool if you want to do python on Windows.

Comments

0

There is Wax, whose purpose was to create a more pythonic interface to wxWidgets, but it seems its development has stalled.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.