This article covers the most popular GUI Frameworks in Python.
One of Python’s strongest selling points is the vast number of GUI libraries available for GUI development. GUI development can be a tricky task, but thanks to the tools these Python GUI frameworks provide us, things become much simpler.
While some of the below GUI libraries are similar and directly compete with each other, each library has it’s own pros and cons. Sometimes you have special libraries designed for a specific situation, like Kivy is for touchscreen devices. So you don’t have to learn just one.
There are a large number of GUI frameworks in Python and we couldn’t possibly cover all of them. Hence we’ll just be discussing 5 of the most popular and important GUI frameworks in Python.
I decided to start with Tkinter as it’s probably the oldest and most well known GUI framework in Python.
Tkinter was released in 1991 and quickly gained popularity due to its simplicity and ease of use compared to other GUI toolkits at the time. In fact, Tkinter is now included in the standard Python Library, meaning you don’t have to download and install it separately.
Other plus points include the fact that Tkinter has a pretty small memory footprint and a quick start up time. If you were to convert a Tkinter application into an exe with something like pyinstaller, it’s size would smaller than the other GUI library equivalents.
The only downsides to Tkinter are it’s rather outdated and old design. If you’re goal is to create a sleek and modern-looking GUI, Tkinter probably isn’t the best choice. Another possible downside is that Tkinter has fewer “special” widgets than the others, such as a VideoPlayer widget. Such widgets are used rarely, but still important.
You can begin learning it with our very own Tkinter Tutorial series.
PyQt5 is the Python binding of the popular Qt GUI framework which is written in C++.
PyQt5’s main plus points is it’s cross platform ability and modern looking GUI. Personally I’ve noticed quite a few people switching from Tkinter to PyQt5 to be able to create for stylish GUI’s.
Another one of PyQt5’s plus points is the Qt Designer. The Qt Designer is a drag and drop kind of tool where you don’t have to code in each widget individually. Instead, you can simply “drag” the widget and “drop” it onto the screen to create a GUI. It’s similar to Windows Form (VB.NET) and the Scene Builder (JavaFX).
PyQt5 downsides include it’s relatively large package size and slow start up speed. Furthermore, PyQt was released under the GPL License. This means you cannot distribute any software containing PyQt code without bundling the source code with it as well. For someone selling commercial software, this a significant set back. You’ll have to buy a special commercial license which gives you the right to withhold the source code.
The license issue isn’t something just should bother the average programmer though. You can begin learning PyQt from our very own tutorial series here!
If you’ve narrowed down your GUI of choice between Tkinter and PyQt5 and are having a hard time picking one, I suggest you read this comparison article that compares both in a very detailed manner.
We’re bringing up PySide right after PyQt5 due to their strong connection. PySide is also a Python binding of the popular Qt GUI framework. Because of this reason the syntax is almost the exact same with some very minor differences.
The reason why PyQt is used more nowadays is because it’s development was faster than that of PySide. When Qt5 was released, PyQt released their binding for it (called PyQt5) in 2016. Whereas it took PySide an extra 2 years to release PySide2 in 2018. If both had released at the same time, things might have been a bit different today.
All the plus points for PyQt5 also apply for PySide2, with an extra addition. Unlike PyQt5, PySide was released under the LGPL license, allowing you to keep the source code for your distributed programs private. This makes the selling of commercial applications easier than it would be using PyQt5.
You can learn more about PyQt5 vs PySide2 from this article here.
Kivy is an opensource multi-platform GUI development library for Python and can run on iOS, Android, Windows, OS X, and Linux.
The Kivy framework is well known for it’s support for touchscreen devices and it’s clean and modern looking GUI’s. It’s GUI and widgets have the interactive, multi-touch kind of ability that’s required for any decent GUI on a touchscreen device like a mobile.
The one possible downside to GUI’s created with Kivy is the non-native look. This may or may not be something you wish to have. Other issues may include the smaller community and lack of documentation compared to more popular GUI libraries like Tkinter.
If you’re looking to be developing on Desktop mostly, then it’s better to stick to one of the Qt options. Mobile support is Kivy’s greatest draw after all.
wxPython is a Python open source cross platform GUI toolkit. Similar to how PyQt5 is based of the Qt GUI framework, WxPython is also based of a GUI framework called wxWidgets written in C++.
It’s purpose is to allow Python developers to create native user interfaces for their GUI applications on a wide variety of different operating systems.
The native GUI ability makes GUI’s created by wxPython looks very natural on any Operating system that they are run. Although some people may not want to have this native GUI look, instead preferring to have one look/style that is the exact same across all platforms.
This marks the end of the Python GUI Frameworks article. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the article content can be asked in the comments section below.