Tkinter - Most Popular Python GUI Framework
Written by Mike James   
Tuesday, 05 July 2022

JavaScript has HTML, Java has Swing and Java FX, but how about Python? What do Python developers use to create a GUI interface. To find the answer we looked at the recently published 2021 Python Developers Survey.

pfsbannerJanet Swift has already taken a first look at this survey of over 23,000 Python developers and enthusiasts from almost 200 countries or regions, but I wanted to answer a very specific question. Which 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 looked at from a different prespective this is also a weakness. Given the availability of competing third party add-ons for Python there is no such thing as a standard 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 top runners while 29% of respondents don't use a web framework. This seems to have face validity as 45% of respondents use Python for Web development - it is the second most popular arena after Data analysis, which is the use for Python cited by 51%. 

Which Python users are most likely to need tools to create GUI interfaces?

The most obvious group is Desktop development which is an option selected by 19% of survey respondents. Unfortunately, the survey doesn't separate out GUI Framework tools, instead they are lumped together 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 don't 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 can be overlap with respondents selecting more than one of these.

PythonGUIChart

The impossible to pronounce name "Tkinter" is shorthand for "Tk interface", which is easy to say and conveys the idea that is a Python binding to the Tk GUI toolkit. Co-written by Guido van Rossum and first released in 1991 it is considered Python's de facto standard GUI. Tkinter is free and is included with standard Linux, Windows and macOS installs of Python. Tkinter may be included in Python but there are attractive alternatives which make many a programmer think that perhaps Tkinter's days might be numbered.

The main contender to Tkinter, used by 15%, is PyQt, the Python binding of the cross-platform GUI toolkit Qt, pronounced "cute". Developed by Riverbank Computing and first released in1998 it supports Windows, Linus and macOS. It is subject to a variety of licences - GNU, GPL and commercial. It is currenly at 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 is sophisticated and promises a lot but to get it all you need a commercial licence.

wxPython was also first released in 1998 and its latest stable release. 4.1.1 was in November 2020. It is a wrapper to wxWidgets implemented as a Python extenstion module. It is free software under the wxWindows License which is approved 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 too is free software and is licensed under the LGPL. Its original author is GNOME developer James Henstridge, but its most recent stable release, 2.24 was in 2011 and it has been replaced by PyGObject, which provides bindings for GObject based libraries including GTK, GStreamer, WebKitGTK, GLib and GIO. While PyGTK is used by 3%, its replacement isn't listed.

kivylogo

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 isn't an alternative to Tkinter as it fills a different niche - developing mobile apps and other multitouch apps 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 fits with the finding that 6% of Python useage is for Mobile development.

pygame

PyGame is another framework that can be considered as an alternative to Tkinter and it is used by 13% of respondents to the Python Developer Survey, which accords well with 10% using Python for Game Development and 12% for Computer Graphics. PyGame was originally released in October 2000, written by Ppete Shinners to replace PySDL, and its most recent version 2.1.2. came outr in December 2021. It is released under the GNU Lesser General Public License which provides for it to be distributed with both open source and commercial software.

 

fourPyGui

 

So what is the conclusion?

Tkinter is probably better regarded as the true standard Python GUI than many programmers think. It is easy to call it old and not exciting and to worry about its place in the future, yet more Python programmers use it than anything else and it is completely open source. 

  • Mike James is the author of the Programmer's Python: Something Completely Different series of books which set out to show how Python diverges from other programming languages and how its special features deserve our attention. The second volume Programmer's Python: Everything Is Data was published in May and last week saw the publication of Programmer's Python: Everything Is An Object, 2nd Ed. The third volume on Asychronous and Concurrent Python is expected in the next few weeks.

More Information

Python Developers Survey 2021 Results

Related Articles

Python Is Everywhere - 2021 Survey Results

Creating The Python UI With Tkinter - The Canvas Widget

Kivy 1.10 Released

Pygame Updated

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Quantum Computers Really Are A One Trick Pony
17/03/2024

Google is offering $5 million if you can think up a use for a quantum computer. Wait, I thought quantum computers were the next big thing, a revolution! Surely we know what they can do?



Android 15 Developer Preview Updated
25/03/2024

Google has released Android 15 Developer Preview 2 with changes including better handling of automatic language switching and updates for OpenJDK 17.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962668>

<ASIN:1871962749>

Last Updated ( Wednesday, 06 July 2022 )