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.
Simple question:
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.
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.
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)
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.
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).
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.
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).
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:
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.
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).
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.