Bio-Python

"Ramblings on computational chemistry, in silico experiments and programming in python 3.x"

February 17, 2013

Python-3 GUI. What developer options exist?

After reading article about "file reading and copying", few readers via comments on g+ and email asked to write about GUI development in python 3. Frankly, I have never been GUI fan but for the sake of requests I explored some development options available. My preference is summarized below:

For python 2.7 : wxPython > pyQt > tkinter
For python 3.x : PyQt > tkinter (no WxPython support while the time of writing this)

There are more options available which I have not explored yet. (An exhaustive list can be found here: GUI programming.)

First and foremost, I'd like to say that wxPython is one of the best project as per my literature survey (notably, GvR  quoted it to be most mature GUI project) but since it has not been ported into python 3.x, I will talk only about PyQt4. WxPython is under very active development and hopefully soon it will be released for py3k and its progenitors.

Why not show love for tkinter?

Yes, obviously it is native in python, stable and simple but what I don't like about tkinter is that it often tends to have a non-native look. Tkinter windows (or frames if u like to call it phuff!!) often look strikingly different from current theme. Secondly, unlike PyQt and WxPython, tkinter does not have a very active user community.

IDLE; python's own IDE is designed using tk. On my arch linux running XFCE desktop environment its frames appear noticeably different from that of other applications.

Importing ttk which is one way to address issue of incongruous appearance of tkinter. (but be aware, ttk alters the methods of tk widgets so don't be surprised if you cannot call select/deselect on a checkbutton with ttk.) Call me biased but I find pyQt and wxPython more tweak-able than tkinter.

Important note :

PyQt comes in two different license versions:
  1. GPL (code must be made available)
  2. Commercial license (costs money)
There's also PySide which is mostly but not completely compatible with PyQt and comes with less restrictive license (LGPL) that allows both open source and proprietary software development. This difference in license might be of great significance to those who seek to develop commercial application.
    As of now, I only found PyQt4 as a mature project that is ready for python 3. If you are using other python GUI development tool, tell how it is superior than the ones mentioned here (tk, wxpython and pyqt). Also mention whether it is available for python 3. In coming weeks I will briefly summarize the PyQt4 modules and will show how to develop simple frames.