Create GUI Applications with PyQt6
Want to create GUI applications with Python?
Here is everything you need to go from your
first window to complete apps.
PyQt is a Python library for creating GUI applications using the Qt toolkit.
Created by Riverbank Computing, PyQt is free software (GPL licensed) and has been in development since 1999. The latest version PyQt6 -- based on Qt 6 --
was released in 2021 and the library continues to be updated.
This complete PyQt6 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.
Take your first steps creating Python GUI applications with these
simple step-by-step guides to Python & Qt.
PyQt6 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.
Work through the fundamental building blocks of GUI applications
that you can use to create your own apps.
- Connect button presses to actions in your apps with Signals, Slots & Events
- Take a look at Widgets available in PyQt6
- Arrange widgets together using Layouts to build real applications.
- Add toolbars & menus with keyboard shortcuts using QAction.
- Popup dialogs to get confirmation, or select files.
- Build multi-window applications.
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 editor — Qt 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.
- Take your first steps with Qt Designer & find out
how to create UIs and use them in Python
- Work through how to lay out your UIs in Designer to get the hang of how Qt Designer works
- Learn how to create custom Dialogs with Designer and use them in your apps
If you're upgrading from PyQt5, note that the QResource framework was removed in PyQt6.
Latest Qt Designer tutorials
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 PyQt6 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.
- Use the model view architecture to display dynamic data from any source
- Display numpy and Pandas data frames as spreadsheet tables in your PyQt6 applications
- Use Matplotlib to add interactive plots to your apps
- Or take a look at PyQtGraph for high performance graphs and other visualizations
If you're using Qt Designer to create your applications, take a look at
how to use PyQtGraph & Matplotlib widgets inside Qt Designer.
Latest Data Science tutorials
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.
- Learn how to execute long-running tasks using a thread pool and send and receive data
- Execute external programs in another process and communicate with them with streams
Qt comes with a large library of widgets built-in. But sometimes your applications
need something different. In PyQt6 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.
- Learn about drawing graphics bitmap primitives
- Assemble existing widgets to create compound widgets
- Add animations and transitions to your widgets to make them feel more tactile
Latest Custom Widgets tutorials
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.
- Packaging your applications on Windows with PyInstaller
- Packaging your apps on macOS including building .app bundles and Disk Images
PyQt6 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.
- Get started building your first QML/Qt Quick application
- Learn about QML animations and transformations, by building an analog desktop clock
Want to create GUI applications with Python? Here is everything you need to go from your first window to complete apps.
PyQt is a Python library for creating GUI applications using the Qt toolkit. Created by Riverbank Computing, PyQt is free software (GPL licensed) and has been in development since 1999. The latest version PyQt6 -- based on Qt 6 -- was released in 2021 and the library continues to be updated.
This complete PyQt6 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.
Take your first steps creating Python GUI applications with these simple step-by-step guides to Python & Qt.
PyQt6 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.
Work through the fundamental building blocks of GUI applications that you can use to create your own apps.
- Connect button presses to actions in your apps with Signals, Slots & Events
- Take a look at Widgets available in PyQt6
- Arrange widgets together using Layouts to build real applications.
- Add toolbars & menus with keyboard shortcuts using QAction.
- Popup dialogs to get confirmation, or select files.
- Build multi-window applications.
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 editor — Qt 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.
- Take your first steps with Qt Designer & find out how to create UIs and use them in Python
- Work through how to lay out your UIs in Designer to get the hang of how Qt Designer works
- Learn how to create custom Dialogs with Designer and use them in your apps
If you're upgrading from PyQt5, note that the QResource framework was removed in PyQt6.
Latest Qt Designer tutorials
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 PyQt6 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.
- Use the model view architecture to display dynamic data from any source
- Display numpy and Pandas data frames as spreadsheet tables in your PyQt6 applications
- Use Matplotlib to add interactive plots to your apps
- Or take a look at PyQtGraph for high performance graphs and other visualizations
If you're using Qt Designer to create your applications, take a look at how to use PyQtGraph & Matplotlib widgets inside Qt Designer.
Latest Data Science tutorials
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.
- Learn how to execute long-running tasks using a thread pool and send and receive data
- Execute external programs in another process and communicate with them with streams
Qt comes with a large library of widgets built-in. But sometimes your applications need something different. In PyQt6 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.
- Learn about drawing graphics bitmap primitives
- Assemble existing widgets to create compound widgets
- Add animations and transitions to your widgets to make them feel more tactile
Latest Custom Widgets tutorials
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.
- Packaging your applications on Windows with PyInstaller
- Packaging your apps on macOS including building .app bundles and Disk Images
PyQt6 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.
- Get started building your first QML/Qt Quick application
- Learn about QML animations and transformations, by building an analog desktop clock
Books
Hands-on guides to Python GUI programming
Books taking you from first principles to fully-functional apps, not toy examples.