Most popular Python GUI framework
Janet Swift has already taken a first look at this survey of over 23,000 Python developers and enthusiasts from nearly 200 countries or regions, but I wanted to answer a very specific question. What is the most popular way for Python developers to create a user interface?
One of Python’s strengths is the number of libraries and developer tools in its ecosystem. But seen from another point of view, it is also a weakness. Given the availability of competing third-party add-ons for Python, there are no standards in several important areas.
The Frameworks and Libraries section of the Python Developer Survey starts with web frameworks, reporting that Flask (41%) and Django (40%) are the best while 29% of respondents do not use a web framework. This appears to have face validity as 45% of respondents use Python for web development – this is the second most popular area after data analysis, which is Python use cited by 51%.
Which Python users are most likely to need tools to create GUIs?
The most obvious group is desktop development, an option selected by 19% of survey respondents. Unfortunately, the survey does not separate the GUI Framework tools, but instead they are grouped into “Other frameworks and libraries”, a category dominated by Requests, an HTTP library used by 52%, and the imaging library, Pillow (31 %); 19% of respondents do not use any of those listed. Five GUI toolkits are included in the list – Tkinter, used by 19% of respondents, PyQT (15%), Kivy (6%), wxPython (4%) and PyGTK (3%). Of course, there may be overlap with respondents selecting more than one.
The name impossible to pronounceTkinter” is shorthand for “Interface Tk”, which is easy to say and conveys the idea that this is a Python binding to the Tk GUI toolkit. Co-authored by Guido van Rossum and first published in 1991, it is considered Python’s de facto standard GUI. Tkinter is free and comes with standard Linux, Windows, and macOS installations of Python. Tkinter can be included in Python, but there are some interesting alternatives that make many programmers think that Tkinter’s days might be numbered.
Tkinter’s main competitor, used by 15%, is PyQt, the Python binding of the Qt cross-platform GUI toolkit, pronounced “cute”. Developed by Riverbank Computing and first released in 1998, it supports Windows, Linus, and macOS. It is subject to a variety of licenses – GNU, GPL and commercial. This is currently version 6.3 which was released in April 2022. This is probably the GUI library that most people think of when considering any sort of alternative. It’s sophisticated and promises a lot, but to get it all, you need a commercial license.
wxPython was also first released in 1998 and its latest stable release. 4.1.1 was November 2020. This is a wrapper for wxWidgets implemented as a Python extension module. It is free software under the wxWindows license which is endorsed by the Free Software Foundation and the Open Source Initiative. Dropbox is an application developed with wxPython but it is only used by 4% of respondents to the Python Developer Survey.
PyGTK wraps the GTK graphical user interface library. It is also free software and licensed under the LGPL. Its original author is GNOME developer James Henstridge, but its most recent stable release, 2.24, dates from 2011 and has been superseded by PyGObject, which provides bindings for GObject-based libraries including GTK, GStreamer, WebKitGTK, GLib, and GIO. While PyGTK is used by 3%, its replacement is not listed.
Kivy is a relative newcomer as it was originally released in 2011 and most recently updated to version 2.1.0 in March 2022. It is not an alternative to Tkinter as it fills a different niche – the development of mobile applications and other multitouch applications requiring a natural user interface. It is distributed under the terms of the MIT license and can run on Android, iOS, Linux, macOS and Windows. It is used by 6%, which matches the finding that 6% of Python usage is for mobile development.
PyGame is another framework that can be considered an alternative to Tkinter and it is used by 13% of Python developer survey respondents, which lines up well with 10% using Python for game development and 12% for infographics. PyGame was originally released in October 2000, written by Ppete Shinners to replace PySDL, and its most recent version 2.1.2. was released in December 2021. It is released under the GNU Lesser General Public License which provides for its distribution with open source and commercial software.
So what’s the conclusion?
Tkinter is probably better considered the true standard Python GUI than many programmers think. It’s easy to call it old and unexciting and worry about its place in the future, but more Python programmers use it than anything else and it’s completely open source.
2021 Python Developer Survey Results
Python Is Everywhere – 2021 Survey Results
Creating the Python UI with Tkinter – The Canvas Widget
Release of Kivy 1.10
To be notified of new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
or send your comment to: [email protected]