5 open source Python GUI frameworks

Does your Python program need a graphical user interface? Here are five tools to help you build one.


Image credits :  PixelAnarchy on Pixabay, CC0. This article was originally published in May 2016 and has been updated with new information. There comes a time in the journey of most any programmer when they are ready to branch out past the basic examples and start to build a graphical interface to their program.

In Python, the steps to get started with GUI programming are not terribly complex, but they do require the user to begin making some choices. By its nature as a general purpose programming language with interpreters available across every common operating system, Python has to be fairly agnostic as to the choices it presents for creating graphical user interfaces.

Fortunately, there are many options available for programmers looking to create an easy way for users to interact with their programs. Bindings exist for several UI frameworks on a variety of platforms, including those native to Linux, Windows, and Mac, and many that work across all three.

Before going any further, be your own devil's advocate for a moment and ask: Does it really make sense for your application to have a traditional graphical user interface at all? For some programs, the answer is obvious. If your application is inherently graphical, and is either optimized for or just makes sense to be run locally on a single local machine, then yes, you probably should consider building a desktop GUI. Many times, this is made obvious by what you're designing.

But for general purpose programs, don't count out either the command line or a web interface. The command line offers many advantages—speed, remote access, reusability, scriptability, and control—which may be more important for your application's users than a graphical interface, and there are many libraries like ClickCement, and Cliff that make it easier to design great command line programs.

Similarly, a web interface, even for a program meant to be run locally, might be an option worth considering, particularly if you think your users may wish to host your application remotely, and projects like DjangoFlask, or Pyramid all make this straightforward. You can even use a library like pywebview to put a thin wrapper around a web application in a native GUI window.

Alternately, you can use a framework like Pyforms to build a consistent experience across the web, command line, and desktop, all with a single code base.

Still sure you want to build a GUI? Great, here are a few fantastic open source libraries to get you started.

PyQt, PySide, and Qt for Python

PyQt implements the popular Qt library, and so if you are familiar with Qt development in another language, perhaps from developing native applications for KDE or another Qt-based desktop environment, you may already be familiar with Qt. This opens up the possibility of developing applications in Python which have a familiar look and feel across many platforms, while taking advantage of the tools and knowledge of the large Qt community.

Qt is well established in the developer community and has tooling reflecting that. Writing Python applications around Qt means you have access to QtCreator, which features a designer mode to generate code for the layout of your application.

PyQt is dual licensed under both a commercial and GPL license, not unlike Qt project itself, and the primary company supporting PyQt offers a license FAQ to help understand what this means for your application.

For another option to use Qt libraries with Python, consider Qt for Python (commonly known as PySide2), available under the LPGL.

Tkinter

If there were a single package which might be called the "standard" GUI toolkit for Python, it would be Tkinter. Tkinter is a wrapper around Tcl/Tk, a popular graphical interface and language pairing fir