Top 10 Python GUI Frameworks Compared

201 VIEWS

· ·

Graphical User Interfaces (GUIs) are one of the most important parts of any web application. Some would say THE most important part, since today’s sophisticated users are quick to abandon applications with poor usability. The same is true for Python applications, as well. Novice Python programmers usually experiment with building a GUI after they have mastered the basics of Python programming. That’s when they find out a framework is essential for effective GUI development, but Python has no lack of GUI frameworks. The question quickly becomes, which one is the best for your application?

To answer this question we first have to know why a GUI is important for your application.

Why Is A GUI Important?

Your GUI is your application’s first impression. If you’re hoping to be successful, you can’t afford to make a bad first impression. You’re going to need a lot of different graphical elements, including buttons, checkboxes, toggles, dropdown lists, search fields, sliders, tooltips, and many more — everything your user needs to interact with the functionality provided by your application. Haphazard placement or unappealing widgets won’t help with first impressions.

Security and performance are also key factors that define the quality of your application and your user’s experience with it. You’ll want your application to be both fast and secure, but you don’t want to have to sacrifice your GUI to do it. If users have trouble interacting with your application efficiently, your user base is going to suffer.

Why Is A GUI Framework Important?

Development frameworks are designed to make the life of a developer easier. They make a particular kind of application easier to create, or a particular language easier to work with. A GUI framework for Python makes developing the user interface for your application far easier than trying to code it by hand in Python.

Now that you know what to look for, I’ll count down what I consider to be the top ten Python GUI frameworks. For each, I’ll discussing their unique selling points, including: 

  • Why you should consider using them
  • Unique advantages each one offers
  • Framework limitations you should be aware of

Before You Start: Install Our GUI Frameworks Ready-To-Use Python Environment

The easiest way to get started testing out GUI frameworks is to install our GUI Frameworks Python environment for Windows or Linux, which contains a version of Python and most of the packages listed in this post.

Installer

In order to download the ready-to-use GUI Frameworks Python environment, you will need to create an ActiveState Platform account. Just use your GitHub credentials or your email address to register. Signing up is easy and it unlocks the ActiveState Platform’s many benefits for you!

Or you could also use our State tool to install this runtime environment.

For Windows users, run the following at a CMD prompt to automatically download and install our CLI, the State Tool along with the GUI Frameworks runtime into a virtual environment:

powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1'))) -activate-default Pizza-Team/GUI-Frameworks-Win"

For Linux users, run the following to automatically download and install our CLI, the State Tool along with the GUI Frameworks runtime into a virtual environment:

sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) --activate-default Pizza-Team/GUI-Frameworks

10–PyGUI

The Python GUI Project, aka PyGUI framework, is a simple API for developers to create user interfaces using native elements for Python applications. As a lightweight API, not a lot of code is needed between the app and the target platform, making it far more efficient than many of the other frameworks on this list.

Advantages:

  • Documentation all written in Python
  • Available in Python 2 and 3
  • Support for other Python extensions like OpenGL and GTK
  • Cross-platform
  • Open source
  • Easy install via pip

Limitations:

  • Not pre-installed with Python

9–Wax

Wax is the wrapper for wxPython (see #3 in this list). It offers the same functionality as wxPython, but is far more user-friendly. I’ve also included an example of how to use Wax at the bottom of this post.

Advantages:

  • Open source
  • Cross-platform
  • Easy to use

Limitations:

  • Not pre-installed with Python

8–Pyforms 

Pyforms-GUI is a software layer that forms part of the Pyforms main library, which also includes PyForms-Web, and PyForms-Terminal. Pyforms is the Python implementation of Windows Forms, which lets you develop interactive interfaces for Windows GUI mode, Web mode, and Terminal mode.

Advantages:

  • Open source
  • Cross platform
  • It has a minimal API, so interfaces can be easily defined with just a few lines of Python code
  • You can also code advanced functionalities with minimal effort
  • The code is organized in modules, ready to be reused by other applications
  • Simplifies applications maintenance
  • Fast and easy prototyping
  • Low learning curve
  • Easy install with pip

Limitations:

  • Only available for Python3, and it’s not pre-installed
  • Not suitable for handling a large number of data fields in a form
  • Displays record attribute values, but does not support calling method functions of objects being browsed
  • It can’t display dynamically computed attributes

7–PySimpleGUI

PySimpleGUI was created way back in 2008 to make GUI development in Python more accessible. What’s in a name? Well, much as the moniker implies, this is a GUI framework expressly written for absolute beginners in Python GUI development.

Advantages:

  • Open source
  • Cross platform
  • Python 3
  • Easy to install via pip
  • Easy to learn
  • Lots of documentation and tutorials available, making it a great way to start learning GUI design

Limitations:

  • Should really only be used for simple GUI development
  • Lacks a forms designer

6–Libavg

Libavg is a great Python GUI framework specifically for building touch-based interfaces. It’s built in C++, enabling fast execution times, which are necessary when handling touch-based interfaces.

Advantages:

  • Open source
  • Cross platform
  • Supports common drivers for touch screens
  • Broad range of features, including camera and animation support, as well as GPU effects and text aligning
  • Offers a screen layout engine for different visualization manipulation techniques
  • Supports both Python 2.7 and 3

Limitations:

  • Not pre-installed with Python

5–Kivy

Kivy is a cross-platform, open source Python library (based on Python and Cython) designed for rapid development of apps with complex UIs, like multi-touch apps. Kivy runs on Linux, Windows, OS X, Android, iOS, and Raspberry Pi, and you can run the same code on all these platforms.

The combination of ‘code once, run on multiple platforms’ plus the use of powerful graphic techniques (built-in support for OpenGL ES 2) makes this framework suitable for designers of iOS and Android apps.

Advantages:

  • Open source
  • MIT license
  • Built-in widgets
  • Cross platform

Limitations:

  • Not pre-installed with Python

4–PySide2

PySide2 is Qt for Python, offering the official Python bindings for Qt. This enables the use of Qt APIs in Python apps, and also a binding generator tool (Shiboken2) to expose C++ projects in Python.

Qt is considered the standard for GUI design against which all other Python GUI frameworks are measured. As such, PySide2 gives Python developers access to a proven collection of tools and libraries for the fast and flexible creation of user interfaces.

Advantages:

  • Easy install via pip
  • Supports both Python 3 and Python 2.7
  • Cross platform
  • Extensive community support and documentation
  • Used by well known companies like TomTom and Mercedes

Limitations:

  • Not pre-installed with Python
  • Licensed under LGPL, which makes it questionable for use in commercial applications since you will need to make your source code available
  • Python 2.7 builds are only available for 64 bit versions of MacOS and Linux. Windows 32 bit support is provided on Python 2 only.

3–WxPython

wxPython is a cross-platform GUI toolkit you can use to create robust, functional GUIs in a simple and easy manner. The implementation is a set of Python extension modules that wrap the GUI components of the wxWidgets cross-platform library, which is written in C++.

wxPython creates native user interfaces that add zero additional overhead to the application, giving you the capabilities of a functional library without the burden.

Advantages:

  • Open source
  • Cross platform
  • Supports both Python 2.7 and 3
  • Simple to use
  • Smooth installation with pip

Limitations:

  • Not a part of the pre-installed Python on MacOS

2–Tkinter

Tkinter is a combination of the Tcl and Python standard GUI frameworks giving you all the widgets you need to create a rich UI for whatever application you’re working on, but it’s especially suitable for developing desktop apps. 

Advantages:

  • If you’re using a recent version of Python, Tkinter is most likely already installed
  • Tkinter offers a vast collection of well known widgets, including all the most common ones like buttons, labels, checkboxes etc.
  • Adding code to each widget is straightforward

Limitations:

  • The basic Tkinter widgets are good, but you’ll want to ensure your version of Tkinter also supports the extended set of Ttk widgets

1–PyQt5

PyQt5 is a very well-known GUI framework used by both Python coders and UI designers. One of its components, the PyQt package, is built around the Qt framework, which is a leading cross-platform GUI design tool for just about any kind of application. The PyQt5 package has a detailed set of bindings for Python based on the latest version (v5) of the Qt application framework. It also provides SQL support for connecting to databases.

Creating GUIs is wonderfully easy with the QtGUI and QtDesigner module, providing plenty of visual elements that can be implemented simply by dragging and dropping widgets.

Advantages:

  • Drag and drop functionality for implementing visual elements
  • Add code to visual elements enabling the creation of small- and large-scale apps
  • Cross-platform support for Windows, Mac, Android and Raspberry Pi
  • Easy install with pip

Limitations:

  • Not free! PyQt5 requires you to purchase a commercial licence.
  • Not pre-installed with Python
  • Python 3 support only

Conclusions: Which Python GUI Framework Is Best?

Long story short: it depends on your needs! For example:

  • For Absolute Beginners: I would recommend starting with PySimpleGUI. This framework is easy to follow and has lots of documentation to help you get your head around GUI design and development with Python.
  • If you find PySimpleGUI too limiting: Try something a little more complete like wxPython. It offers a better set of controls in an easy-to-use framework, although its wrapper (Wax) is more user-friendly. Either one would make a good step up over PySimpleGUI – the choice is yours.
  • Design-focused Coders: Keen on GUI design? Try PyQt5, Tkinter or PySide 2. All of them will give you wonderfully flexible controls so you can build the UI of your dreams. However, keep in mind that PyQt5 and PySide 2 will require you to purchase a license.
  • Touch Screen UIs: Need a UI for a touch screen application? Kivy and Libavg are your best bets. If fast execution times are important for you, I would recommend Libavg. On the other hand, if visual design is of paramount importance, stick with Kivy.
  • Form-driven UI: If your application is form-driven, Pyforms is a good choice. Otherwise, Pyforms is hard to recommend.
  • Python 2: if you’re still working with Python 2, there are a number of GUI frameworks that you can try including PyGUI, PySide 2 and wxPython. However, you should be aware that Python 2 is no longer officially supported by the Python Software Foundation or the Python community. If you require Python 2 support, check out our extended support.

For me, the best UI framework is Wax, the user-friendly version of wxPython. It has all the characteristics of an effective Python framework for GUI development without many of the bells and whistles of more complex solutions. However, if you have a need for advanced graphics and design elements, then you should probably be trying PyQt5, Tkinter or PySide 2.

Ready for Wax? Here’s a simple datepicker Python script built with Wax:

from wax import *

from wax.tools.datepicker import DatePicker

import datetime

import time


class MainFrame(VerticalFrame):

    def Body(self):

        p1 = HorizontalPanel(self)

        dp1 = DatePicker(p1)

        p1.AddComponent(dp1)

        p1.AddSpace(10)


        b1 = Button(p1, "Add 1 day", event=self.AddOneDay)

        p1.AddComponent(b1)
   

        p1.Pack()

        self.AddComponent(p1, expand='h', border=4)
 

        p2 = HorizontalPanel(self)

        dp2 = DatePicker(p2, style='dropdown', show_century=1)

        p2.AddComponent(dp2)

        p2.AddSpace(10)

        

        b2 = Button(p2, "Yesterday", event=self.SetToYesterday)

        p2.AddComponent(b2)


        p2.Pack()

        self.AddComponent(p2, expand='h', border=4)
    

        self.Pack()

        self.BackgroundColor = p1.BackgroundColor

        self.dp1 = dp1

        self.dp2 = dp2


        # restrict dp2's range to current year

        thisyear = time.localtime(time.time())[0]

        dp2.SetRange((thisyear, 1, 1), (thisyear, 12, 31))


    def AddOneDay(self, event):

        self.dp1.Inc()

        print "Date set to:", self.dp1.Value


    def SetToYesterday(self, event):

        now = time.localtime(time.time())

        self.dp2.Value = now[:3] # tuple: (year, month, day)

        self.dp2.Dec()


app = Application(MainFrame, title='datepicker-1')

app.Run()

To make the GUI frameworks easier for you to try out, install our GUI Frameworks runtime environment for Windows or Linux, which contains a version of Python and most of the GUI frameworks in this post.

Configuration

With the ActiveState Platform, you can create your Python environment in minutes, just like the one we built for this project. Try it out for yourself or learn more about how it helps Python developers be more productive.


Cordny Nederkoorn is a software test engineer with over 10 years experience in finance, e-commerce and web development. He is also the founder of TestingSaaS, a social network about researching cloud applications with a focus on forensics, software testing and security. Cordny is a regular contributor at Fixate IO. LinkedIn


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

Your email address will not be published. Required fields are marked *