Create GUI Applications with PySide2

Want to create Python GUIs? Here is everything you need to go from simple UIs to complete apps with PySide2.

Building GUI applications with Python doesn't have to be difficult. In this tutorial I'll walk you step by step from simple Python GUIs to real useful apps.

By the end of the tutorial you'll be able to make your own applications, design professional UIs and even create installers and packages to share your apps with other people.

PySide, also known as Qt for Python, is a Python GUI framework for creating GUI applications using the Qt toolkit. PySide is the official binding for Qt on Python and is now developed by The Qt Company itself.

This tutorial requires some basic Python knowledge, but no experience with GUI programming.

Take your first steps creating Python GUI applications with these simple step-by-step guides to Python & Qt.

PySide2 not installed? See our installation guides for Windows, macOS and Linux

Once you're set up you can get started by Creating your first GUI application with Python.

Now you have made your first GUI app, let's go a step further adding widgets and layouts to build some simple Python UIs.

So far we have been creating apps using Python code. This works well in many cases, but it can get a bit cumbersome to define all widgets programmatically. The good news is that Qt comes with a graphical editorQt Designer — which contains a drag-and-drop UI editor. Using Qt Designer you can define your UIs visually and then simply hook up the application logic later.

If you're going to be distributing your applications, you might also want to take a look at the QResource framework which simplifies bundling data files (like icons) with your applications.

Explore Qt Designer

Latest Qt Designer tutorials

Install Qt Designer Standalone

Qt Designer Download for Windows, Mac and Linux

The QResource System

Using the QResource system to package additional data with your applications

Most Python apps need to interact with data sources — whether that's a CSV file, database or remote APIs. One of the main benefits of using Python to build applications is being able to make use of Python's data science tools to process and analyse data.

With PySide2 you can make use of Qt's model view architecture to display performant views of any Python data in your applications. Or embed matplotlib and PyQtGraph plots for dynamic visualizations.

If you're using Qt Designer to create your applications, take a look at how to use PyQtGraph & Matplotlib widgets inside Qt Designer.

Explore Data Science

Latest Data Science tutorials

Displaying tabular data in Qt ModelViews

Create customized table views with conditional formatting, numpy and pandas data sources.

Plotting with PyQtGraph

Create custom plots in PySide with PyQtGraph

Plotting with Matplotlib

Create PySide plots with the popular Python plotting library

Building real applications, you'll find yourself wanting to perform long-running tasks. For example, your application might need to interact with remote APIs or perform complex calculations.

But you'll notice a problem: while the long-running task completes, your app will become unresponsive. Your code blocks Qt from running until it returns.

In these tutorials we'll discover how to use threads & processes to long-running tasks while keeping your app responsive.

Explore Concurrency

Qt comes with a large library of widgets built-in. But sometimes your applications need something different. In PySide2 you can you design your own widgets, drawing them directly in your application.

In these tutorials we'll go through the basics of drawing graphics in Qt to building your own entirely custom widget.

Explore Custom Widgets

Latest Custom Widgets tutorials

Animating custom widgets with QPropertyAnimation

Add dynamic visual effects to your custom widgets

QPainter and Bitmap Graphics

Introduction to the core features of QPainter

Creating custom GUI widgets in PySide2

Build a completely functional custom widget from scratch using QPainter

There comes a point in any app's development where it needs to leave home — half the fun in writing software is being able to share it with other people. Packaging Python GUI apps can be a little tricky, but these guides will walk you through the process step by step.

If you're using Qt Designer you may want to take a look at the QResource system and how you can use it to package data files with your apps.

Explore Packaging & Distribution

Latest Packaging & Distribution tutorials

Packaging PySide2 applications for Windows with PyInstaller & InstallForge

Turn your PySide2 application into a distributable installer for Windows

PyInstaller 4.2 & PySide6

Published 21.04.2021

PySide2 has two APIs for building GUIs. We've already introduced the Qt Widgets API which is well-suited for building desktop applications. Qt also provides a declarative API in the form of Qt Quick/QML. Qt Quick is well suited for building modern touchscreen interfaces for microcontrollers or device interfaces.

Explore QML/QtQuick


Hands-on guides to Python GUI programming

Books taking you from first principles to fully-functional apps, not toy examples.

See all Python GUIs books

Latest Updates

PyQt6 & PySide6 Books updated for 2024 updated

Extended and updated with new examples, demos including Model View Controller architecture

Working With Python Virtual Environments

Setting Your Python Working Environment, the Right Way

Which Python GUI library should you use? updated

Comparing the Python GUI libraries available in 2024


A Simple Text Input Widget

How Trademarks Affect Open Source Software

How do trademarks relate to copyrights and what are the implications for open source software

Customizing Your Tkinter App's Windows

Make Your Tkinter App's Windows Have Different Looks

More articles