Where to get started with Python GUI programming?
November 25, 2009 3:46 PM   Subscribe

Which Python GUI framework is right for someone new to GUI programming? But who may also aspire to open source community (linux) development/involvement? Cross platform, wonderful documentation/tutorials, and cruft-free new technology are also welcome.

My current need is just for a simple GUI front end for scripts I write in work for Windows, but one day I'd like to have GUI skills robust enough to help out with open source development. I've given this list a look, but I really don't know where to start. I know GTK/Qt are the most commonly utilized, but are there any exciting new next-generation graphical toolkits? What's fun to learn? What are your favorite tutorials, books, or resources for it?

Any and all suggestions welcome! Thanks!
posted by cowbellemoo to Computers & Internet (14 answers total) 18 users marked this as a favorite
 
I kind of hate all Python GUI libs and there are no good options IMO but wxPython gave me the best results, visually. I personally don't like anything Tk-derived. I hated that layout manager in '95 and I hate it now. I haven't heard of a fraction of that list though so my opinion is not comprehensive.
posted by GuyZero at 3:54 PM on November 25, 2009 [1 favorite]


Qt is really an excellent, excellent toolkit. Surprisingly good. Fantastic. I'm using it extensively in C++. If the Python binding is any good at all, I can wholeheartedly recommend it.
posted by krilli at 3:58 PM on November 25, 2009


Since you asked about next-generation things: a developer I work with has been gushing about TraitsGUI.

(Myself, I keep tiptoeing back from taking the plunge of writing a GUI for my code, so I'll be following this thread with interest.)
posted by dorque at 4:11 PM on November 25, 2009


To follow up on krilli's suggestion, PyQt is exceedingly well-done. I code Qt in C++ and Python every day for my job and PyQt never lets me down. The docs it comes with are good, and there's also an excellent book. Qt is constantly growing and adding wonderful features (the dev blog is a good read), and PyQt keeps pace with both Qt and Python developments.
posted by zsazsa at 4:44 PM on November 25, 2009


Myself, I keep tiptoeing back from taking the plunge of writing a GUI for my code...

And it is a plunge indeed. Do yourself a serious favor: instead of writing your own GUI, write really good interfaces so that anyone else who wants to can write a GUI wrapper around it. Then let them all go nuts.

Not only does this save you from the brink, it usually produces better results. Speaking as someone who used to run teams of programmers and UI guys: they work better this way, and the "perspective of what a normal user needs and cares about" is a different skill set than what most programmers have. The benefits of fresh eyes is also invaluable.

Also, if the GUI sucks, it's completely not tangled up in your code and can be replaced.
posted by rokusan at 5:16 PM on November 25, 2009


I don't have any experince with Qt, but I have a good bit with GTK. Here's an anecdote about the two.

One week ago, I met a few people to hack together, and one guy who usually writes for Qt wanted to integrate his project to a Gnome environment. He spent a few hours and ported the whole thing. At the end, he said "well, the BlahBlah part was a bit uglier in GTK than in Qt." I think the important thing to take away from it is that he created it in a few hours with no real problems.

Here's what I suggest: Glade + PyGTK.

Or, if you don't mind some opinionated ideas about the best way to to it, and some great helper tools, check out Quickly.
posted by cmiller at 5:35 PM on November 25, 2009


I use wxPython and like it a lot. One thing to consider is that PyQT is GPL, so if you release software using it you have to release the code. wxPython is LGPL, so you only have to release any changes you make to the wxPython code, not your entire application. You can buy a commercial license for PyQT from Riverbank if you want to go that route.
posted by demiurge at 5:44 PM on November 25, 2009


It's also quite possible for the approach rokusan suggests to go horribly wrong. Just saying.
posted by flabdablet at 5:56 PM on November 25, 2009


Flabdablet: In contrast, there's a billion tools that do backup on top of rsync. I'm quite sure some are crap, but the tool is strong enough that multiple people have built on top of it. In fact, people build other command line tools on top of it (rdiff-backup) and then build GUI tools on top of that as well.

For Linux based projects, Quickly is designed precisely to cut through this gordian knot of libraries and build tools and deliver a "good enough" setup to get started on the stuff that makes your program unique. Donno that there's a Windows template yet.
posted by pwnguin at 8:38 PM on November 25, 2009


Thanks for the responses so far. At the risk of making this partisan, is there any compelling reason for a beginner to choose Qt over GTK or vice versa? Qt's got that book going for it (thanks zsazsa) but maybe there's some value to being familiar with the Gnome development ecosystem with GTK since I'm a gnome fan? I guess the concepts and skills from one are pretty portable to the other, though, so maybe it's not even worth much thought at this point...?
posted by cowbellemoo at 10:30 PM on November 25, 2009


There is a difference in style. That's it, I think. The style of thinking and expression.

To me, Qt feels unencumbered: It does what I anticipate, and it's easy to figure out how to tell it to do things. To me, GTK feels weird and unnecessarily tied to C-like thinking.

To someone who is fluent in C, I bet Qt feels all fuzzy and vague, and GTK crisp and consistent.
posted by krilli at 4:03 AM on November 26, 2009


... but the difference is less, the similarity is greater.

IOW, cmiller's comment is the law while my last one is the corollary.
posted by krilli at 4:04 AM on November 26, 2009


It isn't Python, but Adobe AIR makes building GUI apps drop dead simple. Especially if you are comfortable with web-based tech.
posted by bprater at 10:48 AM on November 26, 2009


krilli and subby, PyGTK is very Pythonic. It doesn't hew to C++ or C idioms at all. They did a good job implementing it.
posted by cmiller at 12:05 PM on November 29, 2009


« Older Help Identifiy this china.   |   Cite, please. Newer »
This thread is closed to new comments.