views:

1567

answers:

6

Hi

If one wants to develop a user interface in Python, which one to go for: TkInter or PyQt.

I just started with TkInter and I was able to get some simple UIs going with elementary widgets like label, button, text box etc. Just curious to know how good PyQt would be compared to TkInter?

cheers

+12  A: 

PyQt if you're developing anything serious, especially as things you learn will translate directly to working with Qt in other languages too if you ever need to, and Qt is probably the best cross-platform interface toolkit available right now.

There are only two real (potential) disadvantages: PyQt is only available under the GPL (meaning your code also has to be available under a compatible license or under the terms of Nokia's GPL Exception if you release it) or under a commercial license (which costs money). This is in contrast to Qt, which is now available under the LGPL. PyQt is also not included by default with Python installations--you're going to have to package the library yourself. (Ars Technica has a good article on doing it for Windows and OS X.)

Sam DeFabbia-Kane
For open source, PyQt grants an exception to the GPL that specifies the list of licenses that you may use. The full text of the exception can be found here and a copy is included in the PyQt source package. http://www.riverbankcomputing.co.uk/software/pyqt/licensehttp://doc.trolltech.com/4.4/license-gpl-exceptions.html
sunqiang
Right, thanks. I added a note.
Sam DeFabbia-Kane
Nokia has started building a library called PySide which provides almost identical functionality as PyQt, but under the LGPL. It's only available on *NIX based systems right now. But you can pretty much just swap "PyQt4" with "PySide" in your imports and have (almost) everything work. http://www.pyside.org
James
+1  A: 

I am using TkInter for small applications with simple interface. I've never tried to make a real app with it but I guess that it may be difficult.

For big apps, PyQt is maybe a better choice... but the licensing may be a problem.

Personnaly, I would prefer wxPython

luc
+6  A: 

PyQT is our main GUI toolkit now and after 1 year of development I don't want to return to anything else. It's stable, mature, cross-platform and completely native. Even the system dialog boxes (for example to open files) are the ones used by your operating system. I tweaked my XP theme and now my apps skin accordingly. This creates a very professional look, not comparable with a toolkit like Swing. The API is extensive and goes beyond the pure GUI things like widgets. It has support for database connectivity, printing, threading (I used it and it works like a charm),... I even use it to generate PDF's (no other external libs needed). I would recommend Mark Summerfield's book though 'Rapid GUI Programming with Python and Qt' to get you on speed. Keep in mind that QT comes with a GUI builder (Qt designer) which is the best I have used (and I tried lots of them). I even use this builder to create mockups to show to users (it is that easy!). I introduced it to 2 other developers here and haven't heard them complaining...

Wim Verhavert
A caveat: Qt only *looks* native. The User Interface elements are actually emulated (at least on Mac OS X). The "feel" of the graphical elements is reportedly strange, at times, because of this emulation.
EOL
A: 

I use PyQT - Crossplatform, Easy to work with and reliable. I used tkInter very light and I cant find a point making tkInter better then PyQT.

Kumaresan
A: 

I love pyqt becos of qtdesigner

Kumaresan
+1  A: 

PyQt is really easy to learn and docs for Qt also works for PyQt also there are ports to .NET and Java. So it is fairy cross platform and cross language. Also you have PyQt integrated in eric IDE !!

EDIT:

Oh and support for css styles* is just really brilliant. See new OpenSuSE installer to see what you can do with it.

*It is not full css but bigger part of it.

przemo_li