tags:

views:

1730

answers:

12

Simple question:

  • What Python GUI API's are out there and what are the advantages of any given API?

I'm not looking for a religious war here, I'm just wanting to get a good handle on all that is out there in terms of Python GUI APIs.

+10  A: 

Here's a good list.

Marcel Levy
You missed the "advantages of any given API" part though. The page you linked only gives a description of each API.
Seun Osewa
+1  A: 

PyQt is excellent if you have experience or interest in Qt.

http://www.riverbankcomputing.co.uk/software/pyqt/intro

Ben Hoffstein
+2  A: 

Most python GUI APIs will be wrappers around the most common c/c++ GUI APIs. You've got a python wrapper for gtk, a python wrapper for qt, a python wrapper for .NET, etc etc.

So really it depends on what your needs are. If you are looking for the easiest way to draw native-looking widgets on Linux, Mac, and Windows, then go with wxPython (python wrapper for WX Widgets). If cross-platform isn't one of your needs though, other libraries might be more useful.

Ryan
+1  A: 

I like wxPython or Tk.

Tk comes with the standard Python distribution so you don't need install anything else.

wxPython (wxWigets) seems much more powerful and looks a lot nicer. It also works well cross-platform (though not perfectly because it uses different underlying graphic API's on diff system types)

Corey Goldberg
+3  A: 

Instead of posting a list of your options I will give my humble opinion:

I am in love with wxPython.

I have used Qt in C++ and Tk way back in the Tcl days but what really makes me like wxPython is the demo that you get with it. In the demo you can browse through all the different widgets frames etc that are part of the framework see the source code and actually see how it looks while it is running.

I had some problems getting the Linux version build and installed but now that I have it available I use it all the time. I have used wxPython for small data analysis applications and I have written several internal tools related to comparing test results, merging source code etc.

James Dean
+2  A: 

I found this link a long time a go: http://www.awaretek.com/toolkits.html. It suggests a tookit based on your criteria. For me it suggests wxPython all the time. Anyway it gives you a bunch of scores on the various toolkits. What is right for me may not be right for you. But it gives you how all the tookits scored according to your criteria, so if you don't like the top toolkit for some reason you can see which ones are closest to your criteria.

QT/GTK/WxWidgets (formerly wxWindows) seem to be among the most mature cross platform GUI toolkits. The only issue is that none is installed with the default installation of Python, so you may have to compile the libraries. If you want something with no installation required that just runs, then go with TKInter because as has been mentioned it is installed by default with Python.

Anyway my criteria were 9 on Ease of Use, 10 on maturity of documentation/widgets, 10 on installed base, 5 on gui code generators, 10 on native look and feel for both windows/linux and 1 and 5 for the last two, I'm not big into Mac OSX (even with a 10 here it suggests wxpython).

Cervo
I dug into that page's code, and it doesn't make sense. It's almost impossible for anything to outscore wxPython except if all you care about is ease of learning or running on PDAs. It will even choose wxPython over Tkinter if all you care about is installed base - and Tkinter comes with Python!
JasonFruit
You are right he scoring method is weird. Although installed base is also popularity so based on that it is hard to say. On popularity I seem to see people big into Qt/GTK as well as Wx more than i see those into tkinter. But on installed base you can't beat it
Cervo
+3  A: 

PythonCard is really easy to use. That's what I would recommend.

Here's there writeup:

PythonCard is a GUI construction kit for building cross-platform desktop applications on Windows, Mac OS X, and Linux, using the Python language.

The PythonCard motto is "Simple things should be simple and complex things should be possible."

PythonCard is for you if you want to develop graphical applications quickly and easily with a minimum of effort and coding. Apple's HyperCard is one of our inspirations; simple, yet powerful.

PythonCard uses wxPython. If you are already familiar with wxPython, just think of PythonCard as a simpler way of doing wxPython programs with a whole lot of samples and tools already in place for you to copy and subclass and tools to help you build cross-platform applications.

Greg
PythonCard was super-simple to setup and run. But the GUI tools that come with it are a little clunky.
Jweede
A: 

I've been working with wxPython for a few years now and I like it quite a bit. The best thing about wxPython is that the UI feels native on the different platforms it runs on (excellent on Windows and Linux though not as good on OS/X).

The API lacks some consistency, but you quickly get used to it.

You can check out Testuff (shameless plug, as it's my own product) to get a feeling of what can be done with wxPython (although I must say, with quite a bit of effort).

gooli
+6  A: 

I've used Tkinter and wxPython. Tkinter is quite basic, and doesn't use native widgets. This means that Tkinter applications will look the same on any platform – this might sound appealing, but in practice, it means they look ugly on any platform :-/ Nevertheless, it's pretty easy to use. I found Thinking in Tkinter very helpful when I was learning, because I'd never done any GUI programming before. If things like frames and layout algorithms and buttons and bindings are familiar to you, though, you can skip that step.

You can augment Tkinter with Tix (but be warned, Tix doesn't play well with py2exe). Also check out Python Megawidgets, which builds some more advanced controls using the Tkinter basics.

Finally, Tkinter plays nice with the shell: you can start the interpreter, do things like 'import tkinter' 'tk = tkinter.Tk()' etc. and build your GUI interactively (and it will be responsive). (I think this doesn't work if you use IDLE, though)

wxPython is much better looking, and ships with a much greater range of controls. It's cross-platform (though it seems a bit finicky on my Mac) and uses native controls on each platform. It's a bit confusing, though. It also ships with a demo application that shows off most of its features, and provides a test-bed for you to experiment. Some specific thoughts on wxPython:

  • There are three (?) different ways to lay widgets out. Ignore two of them; just use Sizers. And even then, you can do just about any layout using only BoxSizer and GridBagSizer.
  • All wx widgets have IDs. You don't need to care what the IDs are, but in the old days (I think) you did need to know, so some old code will be littered with explicit ID assignments. And most demo code will have -1 everywhere as the ID parameter (despite the fact that the methods all have ID as a keyword parameter that defaults to -1 anyway).
  • Make sure you get the standard wxWidgets docs as well as the wxPython Demo – you need them both.
  • If you want to use wxPython with py2exe and you want it to look good on Windows XP, you need a bit of trickery in your setup.py. See here
John Fouhy
+1  A: 

EasyGUI is different from other GUIs in that EasyGUI is NOT event-driven. It allows you to program in a traditional linear fashion, and to put up dialogs for simple input and output when you need to. If you have not yet learned the event-driven paradigm for GUI programming, EasyGUI will allow you to be productive with very basic tasks immediately. Later, if you wish to make the transition to an event-driven GUI paradigm, you can do so with a more powerful GUI package such as anygui, PythonCard, Tkinter, wxPython, etc.

EasyGui Website

+1  A: 

I prefer PyGTK, because I am a GNOME guy. Using PyGTK feels very pythonic to me. The code organization feels consistent, the documentation is clean and thorough, and it's a very easy toolkit to get used to (except for maybe Treeviews).

Jeremy Cantrell
I'm becoming a great fan of PyGTK, as well, because it comes together so easily and looks so professional. The only thing I don't like is all the underscores in method names: set_title("Title") looks clumsy to me. But it's well-organized, there's a huge pile of docs, and the interface looks great.
JasonFruit
To each his own, I suppose. I prefer the underscore-style naming convention and feel that camel-case (fooBarBaz) is pretty ugly. Not that it really matters. GTK rocks! :)
Jeremy Cantrell
A: 

wxPython, and I'm assuming PyGTK also, can use wxGlade to help you design most UIs you will create. That is a big plus. You don't have to learn how to hand-code the GUI until you're ready. I made several GUI programs straight from wxGlade before I was comfortable enough in how wxPython worked to take a shot at hand-coding.

PyQt has a similar graphic layout device but I've never had good luck getting PyQt to compile correctly. There was also a lack of tutorials and documentation that showed how to create the final Python code; many of the documents I found referred to the C++ version of Qt.

Tkinter is good for quick and dirty programs but, realistically, if you use wxGlade it may be faster to make the program with wxPython. At a minimum, you can use wxGlade to show a visual representation of the program to a client rather than take the time to hand-code the "dummy" program.

crystalattice
For PyGTK, you use just Glade, not wxGlade.
JasonFruit