*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.

\[OS_EMBEDDED_MENU_RIGHT:\]

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
[Click](http://click.pocoo.org/5/){target="_blank"},
[Cement](http://builtoncement.com/){target="_blank"}, and
[Cliff](http://docs.openstack.org/developer/cliff/){target="_blank"}
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](https://www.djangoproject.com/){target="_blank"},
[Flask](https://opensource.com/article/18/4/flask){target="_blank"}, or
[Pyramid](https://opensource.com/article/18/5/pyramid-framework){target="_blank"}
all make this straightforward. You can even use a library like
[pywebview](https://github.com/r0x0r/pywebview){target="_blank"} to put
a thin wrapper around a web application in a native GUI window.

Alternately, you can use a framework like
[Pyforms](http://pyforms.readthedocs.io/en/latest/){target="_blank"} 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](https://riverbankcomputing.com/software/pyqt/intro){target="_blank"}
implements the popular [Qt](http://www.qt.io/){target="_blank"} 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](https://www.qt.io/development-tools){target="_blank"}, 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](https://www.riverbankcomputing.com/commercial/license-faq){target="_blank"}
to help understand what this means for your application.

For another option to use Qt libraries with Python, consider [Qt for
Python](https://wiki.qt.io/Qt_for_Python){target="_blank"} (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](http://tkinter.unpythonic.net/wiki/){target="_blank"}. Tkinter
is a wrapper around [Tcl/Tk](http://www.tcl.tk/){target="_blank"}, 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](https://docs.python.org/2/library/tkinter.html){target="_blank"}
are easy to get started with and fairly human-readable.

Tkinter is available under the [Python
license](http://tkinter.unpythonic.net/wiki/Tkinter){target="_blank"},
on top of the BSD license of Tcl/Tk.

## WxPython

[WxPython](http://www.wxpython.org/){target="_blank"} brings the
[wxWidgets](http://wxwidgets.org/){target="_blank"} cross-platform GUI
library from its native C++ to Python. WxPython looks a little more
native than Tkinter across different operating systems because it uses
the host system\'s widgets to construct a GUI. 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, or else require the user
to install it on their own, as it is not automatically installed with
Python.

WxPython uses the [wxWindows Library
License](http://www.wxwidgets.org/about/licence/){target="_blank"} of
its parent project, which is [OSI
approved](https://opensource.org/licenses/wxwindows.php){target="_blank"}.

## Python GTK+ 3

Formerly known as PyGTK, the [Python GTK+
3](https://python-gtk-3-tutorial.readthedocs.io){target="_blank"}
project provides Python bindings to GTK objects (windows, widgets, and
so on). GTK+ is most famously used as the foundation for the GNOME
desktop, but it\'s available for stand-alone applications on Linux,
Windows, and Mac. With Python GTK+ 3, the same framework is available
for your Python projects.

When you use Python GTK+ 3, you can use many of the same development
tools created for GTK+ itself. Most notably, this includes
[Glade](){target="_blank"}, an interface designer for GTK+ applications.
Interfaces designed in Glade are saved as XML and used by the GtkBuilder
object in your application code, but the interface you use is
drag-and-drop, making it easy to create a dynamic and responsive UI
without having to translate what you see in your mind into layout code.

## Kivy

Built with rapid development and modern devices in mind,
[Kivy](https://kivy.org/#home){target="_blank"} is a toolkit for Linux
(including the Raspberry Pi), Windows, Mac, and Android. The project is
focused on \"innovative user interfaces\", and it\'s been used for
multimedia applications, like music controller apps for phones to
whiteboarding applications that take up the entire wall of a meeting
room.

Kivy doesn\'t have a visual layout program like QtCreator and Glade, but
it uses its own design language to help you associate UI layout with
code objects. This makes it easy for you to compartmentalise (both
mentally and in the layout code) the classes and functions in your
application. Kivy also hosts the Kivy Garden, a repository of
user-created widgets and add-ons, so if you\'re thinking of creating
something that Kivy itself doesn\'t provide, you may it already exists
in the Garden.

------------------------------------------------------------------------

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](https://wiki.python.org/moin/GuiProgramming){target="_blank"}\"
page on the official Python Software Foundation wiki, which lists dozens
of other tools. Solutions are available to bind Python to many different
widget libraries and GUI tools such as
[FLTK](http://www.fltk.org/index.php){target="_blank"},
[FOX](http://fxpy.sourceforge.net/){target="_blank"}, and many others.
While beginners should probably avoid projects providing only partial
implementations, or those no longer actively maintained, there are
plenty of good tools for a variety of situations.

Many of the options out there are for traditional applications that take
on the windowed look and feel of their parent desktop environment, but
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](http://www.pygame.org/wiki/gui){target="_blank"},
[pyglet](https://bitbucket.org/pyglet/pyglet/wiki/Home){target="_blank"},
and [Panda3d](https://panda3d.org){target="_blank"}.

Do you have a favorite not mentioned here? Let us know in the comments
below!

*Are you interested in reading more articles like this? Sign up for our
[weekly email
newsletter](https://opensource.com/email-newsletter?intcmp=701f2000000tyvNAAQ).*