GEOG 489
Advanced Python Programming for GIS

2.5 GUI options for Python

PrintPrint

We already mentioned in Section 2.4 that often there exist different options for a GUI library to use for a project in a given programming language. This is also the case for Python. Python includes a GUI package called Tkinter in its standard library. In addition, there exist 3rd party alternatives such as the PyQT and PySide wrappers for the QT library, Kivy, Toga, wxPython, and quite a few more. Have a quick look at the overview table provided at this GUI Programming in Python page to get an idea of what’s out there. In contrast to Tkinter, these 3rd party libraries require the installation of additional packages. This can be seen as a downside since it will make sharing and installation of the developed software a bit more complicated. In addition, there are quite a few other factors that affect the choice for a GUI library for a particular project including:

  • For which platforms/operating systems is the library available?
  • Does the library draw its own widgets and have its own style or use the operating system's native look & feel?
  • How large is the collection of available widgets? Does it provide the more specialized widgets that are needed for the project?
  • How easy is the library to use/learn?
  • How easy is it to extend the library with our own widgets?
  • How active is the development? How good is the available support?
  • Is the library completely free to use? What are the license requirements?

In the rest of this section, we will focus on Tkinter and QT with its two Python wrappers PySide and PyQT. We will have quick looks at Tkinter and QT individually, but using the same example of a simple GUI tool to convert miles to kilometers. In the following parts of the lesson, we will then focus solely on writing GUI-based Python programs with PyQT.