Get the highlights in your inbox every week.
How to create a GUI application with Python
3 open source Python GUI frameworks
Does your Python program need a graphical user interface? Here are three tools to help you build one.

Does your latest Python program have a GUI?
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 Windows, Mac, and Linux, and many that will work across all three.
Before we go any further, let me play devil's advocate for just 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 more general purpose programs, don't count out either the command line or a web interface just yet. 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 Click, Cement, 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 Django, Flask, 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 more native GUI window.
Or 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 three fantastic open source libraries to get you started.
PyQt
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-using 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.
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 the Qt libraries with Python, consider checking out PySide, which is 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 first popularized in the early 90s. The advantage of choosing Tkinter is the vast number of resources, including books and code samples, as well as a large community of users who may be able to help you out if you have questions. Simple examples are easy to get started with and fairly human-readable.
Tkinter is available under the Python license, on top of the BSD license of Tcl/Tk.
WxPython
WxPython brings the wxWidgets cross-platform GUI library from its native C++ to Python. WxPython is a slightly more modern approach to, which looks a little more native than Tkinter across different operating systems as it does not attempt to create its own set of widgets (although these can be themed to look much like native components). It's fairly easy to get started with as well, and has a growing developer community. You may need to bundle wxPython with your applications, as it is not automatically installed with Python.
Working with Python 3? Check out wxPython's Project Phoenix, a rewrite of the project which will work with the newest version of Python.
WxPython uses the wxWindows Library License of its parent project, which is OSI approved.
These are not the only choices you have available to you, not even by a long shot. For more options, check out the "GUI programming in Python" page on the official Python Software Foundation wiki, where you will find dozens of other tools. Solutions are available to bind Python to many different widget libraries and GUI tools like GTK+, FLTK, FOX, and others. While beginners will want to look out for and probably avoid projects which are only partial implementations, or those longer actively maintained, you'll find plenty of good fits for a variety of situations.
While many of the options out there are for more traditional applications that take on the windowed look and feel of their parent desktop environment, there are also times when you may wish to do something completely different, for example, within a video game. There are great libraries for these situations too, like pygame and pyglet.
Do you have a favorite that we didn't mention here? Let us know in the comments below!
Are you interested in reading more articles like this? Sign up for our weekly email newsletter.
21 Comments
Tkinter is very well documented as you mentioned, but rather limited, as Tk is, so it's fine for very simple interfaces but not much more. wxPython is much more capable is and is pretty good, but is rather poorly documented, so you just have to find your way with it.
PySide is an LGPL alternative to PyQt. PySide has also recently been adapted by the Qt project and will enjoy first class status as an official Python binding for Qt.
wxWidgets is nice in many ways, but not Python 3 compatible and thus not really a viable alternative for new projects. A Python 3 rewrite under the name of Project Phoenix is underway, but has been so for several years by now without reaching announced production quality.
TkInter is part of the standard lib, but you do not have to look far to see core devs recommending alternatives.
After working with all these alternatives, I would say that PySide is the most interesting way forward at the moment. It will be interesting for the Python community to see how well the Qt project will take care of it.
I like Kivy framework for Python. You can use the same code to run in all environments: Windows, Android, iOS, OS X, Linux, etc.
Kivy is a great framework and is also great on tablet and mobile devices. The one downside is that it's a bit tough for middle school kids. I did some lessons using pygame and Simple Game Code for my son a while back. SGC is simple, as the name states. Also, Pygame isn't intended for GUI applications. The upside is that pygame is simple to use, even for elementary school kids. Leveraging knowledge from Pygame to introduce GUI fundamentals with SGC is useful. The combination might also be good for simple prototypes. More information here: http://pychildren.blogspot.com/search/label/sgc
This is a really good collection of python GUI options. I really appreciate the cli list too as an alt to GUIs.
You can add this 3 to your list too!
Kivy - One of the more interesting projects, the liberal MIT-licensed Kivy is based on OpenGL ES 2 and includes native multi-touch for each platform and Android/iOS. It’s an event-driven framework based around a main loop, and is thus very suitable for game development.
Pyforms - At just two years old (making it one of the more recent frameworks), Pyforms is a Python 2.7/3.x cross-environment framework for developing GUI applications. It is modular and encourages code reusability with minimal effort.
libavg - This is another third-party library, written in C++ and scripted from Python, with properties of display elements as Python variables, a full-featured event handling system, timers (setTimeout, setInterval), support for logging and more. Like Kivy, libavg uses OpenGL and makes use of hardware acceleration.
What about custom graphic gui? with all the framework you can build standard gui with standard elements, e.g. button, radiobutton, and so on, but what about if i want to build interface with custom graphics as, for example, the kodi interface, or the firefox interface, or every other software that have a gui without the "standard" elements?
thanks.
What about custom graphic gui? with all the framework you can build standard gui with standard elements, e.g. button, radiobutton, and so on, but what about if i want to build interface with custom graphics as, for example,
Thanks for the great and practical article! It's really important for a developer to come to the stage, where you start building your own applications not only an interface for them. Here's an article (http://ddi-dev.com/blog/programming/how-choose-technology-stack-web-appl...) about choosing a technology stack for your web apps. Having a full-stack of programming languages makes you a more competitive developer.
I wonder why PyGObject is just mentioned and not even described. Absolutely not complaining about your choices. Just wondering why. Any particular reason? It has a good set of tutorials and documentation. It supports Linux, Windows and macOS and works with Python 2.7+ as well as Python 3.4+.
This is really interesting and useful article! And I want to add a list of the pros and cons of the Python (http://bit.ly/JelvixPython). Sometimes a short review of a programming language may help to make a right choice.
Among the above-mentioned tools, Tkinter is the easiest tool to develop GUI based interfaces.
curses python bindings provide very flexible console control
PySimpleGUI is a new one that's great for beginners and intermediate GUIs. Runs on Python3 on Windows, Mac, Linux, pypy, Raspberry Pi. Anywhere tkinter runs PySimpleGUI should run.
It's a wrapper around tkinter that presents the programmer with a very Python-like interface. GUIs are simple lists of GUI Widgets. Results from a GUI is a list of return values.
pip install PySimpleGUI
I don't have much experience with GUI frameworks
but I wondering what is the purpose/advantage using non-web GUI - ?
web-GUI provides cross platform solution and doesn't require additional installation/dependencys
IUP (Portable User Interface) is a mature easy to use cross platform native UI desktop GUI library. (Dynamic / Static)
A good list to try. Tkinter is most popular I guess?
PyQt is the one
I am looking forward to learn GUI programming with Python
Interesting article
This is a really nice summary of the desktop Python GUI tools. For web GUIs, there are a lot of great open-source options for **running python in the web browser** (that's right, no more JavaScript!!!)
Here's an article (and talk video) where I cover 6 different options, with demos:
https://anvil.works/blog/python-in-the-browser-talk