Saturday, 6 December 2014

Programming GUI's with Python3

The backward incompatible version of the Python programming language, Python3 (introduced on the python.org website as Python3000 or Python3k - see: https://www.python.org/download/releases/3.0/) has had some significant years of development. It was originally released in December 2008. However, the transition of its gigantic arsenal of tools and modules did not keep up - until recently. This is especially true with respect to the GUI tool-kits available for the language. Although Python boasts a breath-taking list of GUI tool-kits, most of these were created for the Python 2.x series.

Apart from Tk(a python GUI tradition, bundled with Python as Tkinter), Qt was probably one of the first major tool-kits with support for Python 3 - known as PySide.

For all the fans of Gtk3, you can develop applications in Python 3 that use the Gtk tool-kit (along with many other components of the Gnome project). The now-deprecated PyGTK is no longer recommended for use. It is time to switch over to the newer, actively-maintained, PyGObject, which provides GObject Introspection bindings for Python 3.

Also among the major players, WxWidgets/WxPython has also begun to see some development for Python 3 in the recent weeks. WxPython releases for Python 3 are created under Project Phoenix.

While views on this may vary, my opinion is that it is of no use to newcomers to the Python world to learn Python 2.x only to have to learn Python 3.x later. Some will argue that it isn't a big deal to learn both; however I would have to say that it is not a worthwhile pursuit when one has a a wide variety of interests and does not have enough time to approach them redundantly ;).

Several years after the initial release of Python 3, we are finally starting to see significant efforts being made to port our favorite libraries and tools to Python 3. This is a relief for those who are tired of the usual responses on various Q&A sites such as, "Why don't you just use Python 2.x? It will be supported for a long time to come". Although some libraries are still not Python3-ready, it's a start.

Here are the links to the toolkits mentioned above:
  1. PySide (Python3 bindings for Qt): http://qt-project.org/wiki/PySide
  2. PyGObject (Python3 bindings for Gtk): https://wiki.gnome.org/Projects/PyGObject
  3. WxPython (Python3 bindings for WxWidgets): http://wxpython.org/Phoenix/docs/html/main.html
For a list of other  Python 3 packages, see https://pypi.python.org/pypi?:action=browse&c=533&show=all

No comments:

Post a Comment