May 30, 2013

Satisfying GUI needs in Python

There are a few GUI libraries that can satisfy the GUI need in Python. I have tried a couple of them so far.

First one I tried was Tk, an open source, cross-platform GUI toolkit. Tk was originally developed as an extension of the Tcl scripting language. But modern Tk supports many languages, including Python. Using Tk was simple and straight forward. But the rapid learning curve of Tk quickly led me to a dead end which made me decide against using it in my current project. The low level graphics programming in Tk is done on Canvas. I needed to draw semitransparent shapes on the canvas. But using RGBA color is not supported in Tk. So I decided to move to another GUI library.

The second one I tried was Qt. Several licensing exists for Qt at the moment and its history is complicated. It can be safely said, Without getting into details, that there is a GNU GPL 3.0 licensed version of Qt is available. For using with Python, PyQt4 can be downloaded and installed.
sudo apt-get install python-qt4
Working with Qt also turns out to be pretty straight forward and simple. This framework also supports building of custom widgets and use of RGBA color is also supported. That's all I needed for the time being. I'm a happy coder now.

No comments:

Post a Comment