To read all comments associated with this story, please click here.
While GTK+ is "just a GUI toolkit", there are a number of other G* libraries (and best of breed stuff like libxml) that address your concerns, since they're based on the same cross-platfrom mase libraries as GTK+. If you don't feel like getting your hands dirty with C, Vala is a great meta-compiler for GObject (and GObject derived libaries) that has a C#-like syntax.
I would encourage you to learn both GTK+ and QT, however. The relative pros and cons of each will better inform your development decisions in the future. Python is a great way to experiment with both, since it has a relatively low barrier to entry.
Hi Funky,
well Qt is available in two licenses: GPL and commercial license. If you don't like to open your code or pay for a license Qt is no alternative, then you should use Gtk.
If you are also willing to buy a license or GPL is ok for you, then Qt and Gtk are both ok.
If you plan to write applications for windows too I would prefer Qt. Why? Because imho it feels faster and it looks much better under windows than Gtk does.
Just my 2 cents.
Mike
With Qt you are not limited to GPL though. You can use many of the other popular free software licenses.
http://trolltech.com/products/qt/gplexception
I have used decent looking GTK+ apps on Windows. These include GIMP, Inkscape, and Audacity (well, thats wx but wx uses gtk). I don't think I have ever used a QT app on Windows except the demo ones that come with QT. Those were fast but they also did next to nothing.
I have not yet used Qt very much. However, from my research:
1) Gtk does things a lot like Microsoft when it comes to messaging. If you know how to create a GUI in Visual C/C++, then Gtk will seem native - you declare your message maps the same way.
2) WxWidgets/WxWindows is need. It does it both the Gtk/Microsoft way, and the Qt Slot way.
3) Qt does not use the Message Map structure really at all - or if it does, it's all hidden. Rather, it uses something called "Slots", which are very dynamic and you call at run time to be added to.
Qt is also its own environment that you can easily extend - this is what KDE does for their ecosystem. You also need to get familiar with the QMake preprocessor that puts a lot of the Qt stuff together for you. The downside of Qt is that you have a big check per developer if you are doing something commercial, something that is not open source. (About $4k/developer for most all platforms Qt supports.) So it can be expensive. Of course, if you are only doing open source, then there is no difference. ;-)
WxWidgets is public domain last I looked. So you can pretty much use it anywhere.
Gtk is of course, GPL or LGPL.
Otherwise, most things are equal and its a matter of preference.
I would recommend Qt. wxWigets is cool and all, but quite slow. GTK is good, but Qt is well documented, easy to use, and seems to be progressing the quickest.
Personally, I learned wx first, GTK second, and Qt last. Looking back, I wish I had done it the other way around.
What follows is my personal opinion based on my experience writing gui code in python. Others may disagree.
WxPython is the easiest toolkit of the three to get up and running with. It is reasonably extensible, quite pythonic, well supported and an all round good choice
PyQt feels more powerful than WxPython for doing complex guis. It also has by far the best graphical gui design tool going, if you prefer do your guis that way. The Qt license can be a problem though if you're not writing Open Source software.
PyGTK is my least favorite (and also the one I have least experience with), but still not a bad toolkit. It's not as easy to get a hang of as WxPython and not as powerful as PyQt. It also has the weakest Windows support of the three.
Anyway, that's my opinion.
Well I'll give you my biased viewpoint.
Choose Qt unless you are writing closed source software and have a budget of zero (in which case you should prepare to fail anyway).
I've tried both (not with Python though) and for just getting stuff done in a cross-platform way, Qt is miles ahead. You say GTK gives you more choice for what libraries to use, but that's not really true. If you don't like the QtXML/SQL/Whatever libs, then you can use any other library you want. But realistically, most of the time you'll opt for the Qt libs because they are all very cross platform, completely documented, and stable.
For every extra lib you use, you gain build environment hassle, cross-platform hassle, and quality hassle. With Qt, it's dead easy to set up a development environment, because for most projects you just need the one set of libs, which are packaged together and tested together.
Even if you only intend to target Linux for now, using Qt gives you (or other devs) more options for a seamless cross-platform experience in the future.
My second choice after Qt would be wxWidgets. It has a more permissive license, and is even more native on Windows than Qt (since it actually uses MFC/Winapi controls).
However be prepared for a less well-tested toolkit and some more issues with getting cross platform support right. Last time I tried it, I found a couple bugs in the toolkit just in the first few hours of using it (they were addressed promptly by the devs though).
The vlc devs recently decided to switch from wxWidgets to Qt4 because of the problems they were having with wx. It also doesn't have the advanced features like a proper canvas and things like Webkit integration (coming in Qt 4.4) and I don't like the coding style as much. But overall it's not a bad choice if you need the license.
Edited 2008-03-12 21:22 UTC







Member since:
2006-07-26
As someone who has never created a GUI in anything other than Java and VB, I am torn between learning GTK+ / wxWidgets, and QT.
QT looks attractive because it has more stuff like XML, collections, networking, threading etc. That is also what makes it unattractive for using QT with languages like Java or Python which already have all that stuff.
Using GTK+ looks attractive because it seems like it is just a GUI toolkit and you can use what libraries you want for the other stuff. But then you can get yourself into trouble if a library you choose isn't supported on all the platforms you're interested in or it may get a little hacky using cygwin / mingw on Windows etc.
Right now I'm learning Python by reading a book just on Python. I'm already writing command line scripts, doing DB stuff etc. Next I plan to survey both GTK+ and QT and make a decision where to devote my brain.
Hopefully how nice QT or GTK+ are to work with in Python reflect how nice they are to work with in C, C++ too.