The complete PyQt5 tutorial — Create GUI applications with Python

The easy way to create desktop applications

Create Desktop GUI Applications with PyQt5

This complete PyQt5 tutorial takes you from first concepts to building fully-functional GUI applications in Python. It requires some basic Python knowledge, but no previous familiarity with GUI concepts. Everything will be introduced step by by step, using hands-on examples.

PyQt5 is the Qt5-based edition of the Python GUI library PyQt from Riverbank Computing.

Looking for something else? I also have a PyQt6 tutorial, PySide2 tutorial and PySide6 tutorial.

This track includes 33 tutorials.

Getting started with PyQt5

Take your first steps building apps with Python & Qt5

Like writing any code, building PyQt5 applications is all about approaching it in the right way. In the first part of the course we cover the fundamentals necessary to get you building Python GUIs as quickly as possible. By the end of the first part you'll have a running QApplication which we can then customize.

Creating your first app with PyQt video

A simple Hello World! application with Python and Qt5

Signals, Slots & Events video

Triggering actions in response to user behaviors and GUI events

Widgets video

Using Qt5's library of built-in widgets to build your applications

Layout management video

Use layouts to effortlessly position widgets within the window

Actions — Toolbars & Menus video

Defining toolbars, menus and keyboard shortcuts with QAction

Dialogs and Alerts video

Notify your users and ask for their input

Creating additional windows video

Opening new windows for your application

Start now

Creating applications with Qt Designer

Using the drag-drop designer to develop your apps

As your applications get larger or interfaces become more complicated, it can get a bit cumbersome to define all elements programmatically. The good news is that Qt comes with a graphical editor Qt Designer (or Qt Creator) which contains a drag-and-drop UI editor — Qt Designer. In this PyQt5 tutorial we'll cover the basics of creating Python GUIs with Qt Designer.

First steps with Qt Designer

Use Qt Designer's drag and drop interface to design your PyQt5 GUI

Laying Out Your PyQt5 GUIs With Qt Designer

Use Qt Designer to effortlessly build your application UI

Creating Dialogs With Qt Designer

Using the drag and drop editor to build PyQt5 dialogs

Embedding custom widgets from Qt Designer

Learn how to use custom widgets in your PyQt5 applications when designing with Qt Designer

The QResource System

Using the QResource system to package additional data with your applications

Start now

Mozzarella Ashbadger

Build your own tabbed web browser with PyQt5

Now we've learnt the basics, we'll put it into practice building a real-life app. In this course we'll create a functional web browser using Qt5 widgets. Starting with the basics and then gradually extending it to add features like opening and saving pages, help, printing and tabbed browsing. Follow the tutorial step by step to create your own app, but feel free to experiment as you go.

Mozzerella Ashbadger video

The first steps building the browser with PyQt5

Adding navigational controls to a PyQt5 Web Browser video

Hook up QAction signals to web browser slots

Open and save HTML in a PyQt5 browser video

Adding file dialogs to load and save HTML

Adding application Help and About dialogs video

Put some finishing touches to your application

Tabbed web browsing video

Use signal redirection to add a multi-tab interface

Start now

Extended UI features

Extending your apps with complex GUI behaviour

In this PyQt5 tutorial we'll cover some advanced features of Qt that you can use to improve your Python GUIs.

Transmitting extra data with Qt Signals

Modifying widget signals to pass contextual information to slots

System tray & Mac menu bar applications

Add quick access functions to your apps

Start now

Threads & Processes

Run concurrent tasks without impacting your UI

As your applications become more complex you may finding yourself wanting to perform long-running tasks, such as interacting with remote APIs or performing complex calculations. By default any code you write exists in the same thread and process, meaning your long-running code can actually block Qt execution and cause your Python GUI app to "hang". In this PyQt5 tutorial we'll cover how to avoid this happening and keep your applications running smoothly, no matter the workload.

Multithreading PyQt5 applications with QThreadPool

Run background tasks concurrently without impacting your UI

Using QProcess to run external programs

Run background programs without impacting your UI

Start now

ModelViews and Databases

Connecting your application to data sources

All but the simplest of apps will usually need to interact with some kind of external data store — whether that's a database, a remote API or simple configuration data. The Qt ModelView architecture simplifies the linking and updating your UI with data in custom formats or from external sources. In this PyQt5 tutorial we'll discover how you can use Qt ModelViews to build high performance Python GUIs.

The ModelView Architecture

Qt's MVC-like interface for displaying data in views

Displaying tabular data in Qt5 ModelViews

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

Start now

Graphics and Plotting

Vector graphics and plotting using PyQtGraph

Python is one of the most popular languages in the data science and machine learning fields. Effective visualization of data is a key part of building usable interfaces for data science. Matplotlib is the most popular plotting library in Python, and comes with support for PyQt built in. In addition, there are PyQt-specific plotting options available such as PyQtGraph which provide a better interactive experience. In this tutorial we'll look at these alternatives and build some simple plot interfaces.

Plotting with PyQtGraph

Create custom plots in PyQt with PyQtGraph

Plotting with Matplotlib

Create PyQt5 plots with the popular Python plotting library

Start now

QGraphics Framework

Vector graphic interfaces

The Qt Graphics View framework is a scene-based vector graphics API. Using this you can create dynamic interactive interfaces for anything from vector graphics tools, data analysis workflow designers to simple 2D games. The Graphics View Framework allows you to develop fast & efficient scenes, containing millions of items, each with their own distinct graphic features and behaviors.

Introduction to the QGraphics framework

Creating vector interfaces using the QGraphics View framework

Start now

Custom Widgets

Designing your own custom widgets in PyQt

Widgets in Qt are built on bitmap graphics — drawing pixels on a rectangular canvas to construct the "widget". To be able to create your own custom widgets you first need to understand how the QPainter system works and what you can do with it. In this PyQt5 tutorial we'll go from basic bitmap graphics to our own entirely custom widget.

QPainter and Bitmap Graphics

Introduction to the core features of QPainter

Creating custom GUI widgets in PyQt5

Build a completely functional custom widget from scratch using QPainter

Animating custom widgets with QPropertyAnimation

Add dynamic visual effects to your custom widgets

Start now

Packaging and distribution

Sharing your awesome applications with other people

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 in this PyQt5 tutorial we'll cover how to package up your apps to share, whether commercially or just for fun.

Packaging PyQt5 applications for Windows, with PyInstaller

Turn your Qt5 application into a distributable installer for Windows

Packaging PyQt5 apps with fbs

Distribute cross-platform GUI applications with the fman Build System

Start now

QtQuick & QML

Building modern PyQt5 GUIs with QtQuick & QML

Qt Quick is Qt's declarative UI design system, using the Qt Modeling Language (QML) to define custom user interfaces. Originally developed for use in mobile applications, it offers dynamic graphical elements and fluid transitions and effects allowing you to replicate the kinds of UIs you find on mobile devices. Qt Quick is supported on all desktop platforms too and is a great choice for building desktop widgets or other interactive tools. Qt Quick is also a great choice for developing UIs for hardware and microcontrollers with PyQt5.

Create applications with QtQuick

Build modern applications with declarative QML

Animations and Transformations with QtQuick

Building an animated analog clock in QML

Start now