Skip to content

Linux/Unix (Qt)

The Toga backend for Linux (and other Unix-like operating systems) running KDE is toga-qt.

toga-qt requires Python 3.10+, and Qt 6.8 or newer.

Experimental Backend

While the GTK 3 backend is mostly completed in functionality, the Qt backend is currently a pre-alpha prototype.

Qt on Windows and macOS

Although Qt can be installed on Windows and macOS, and the toga-qt backend may work on those platforms, this is not officially supported by Toga. We recommend using toga-winforms on Windows, and toga-cocoa on macOS.

Prerequisites

Most Qt testing occurs with Qt 6.10 as this is the version that is installable through pip.

The system packages that provide Qt must be installed manually:

These instructions are different on almost every version of Linux and Unix, in addition to whether Wayland or X11 is used; here are some of the common alternatives:

Ubuntu 24.04 / Debian 11+

(venv) $ sudo apt install git python3-dev build-essential \
             libwayland-dev libwayland-egl1-mesa libwayland-server0 \
             libgles2-mesa-dev libxkbcommon-dev gnome-session-canberra
(venv) $ sudo apt install git python3-dev build-essential \
             libfontconfig1-dev libfreetype-dev libgtk-3-dev \
             libx11-dev libx11-xcb-dev libxext-dev \
             libxfixes-dev libxi-dev libxkbcommon-dev \
             libxkbcommon-x11-dev libxrender-dev 'libxcb*-dev' \
             gnome-session-canberra

You can use deadsnakes (or a similar third-party source) to install a Python version other than the system default by replacing python3-dev with the -dev package matching the desired Python version. For example, to use Python 3.12, replace python3-dev with python3.12-dev.

Fedora 41+

(venv) $ sudo dnf install git python3-devel \
             libcanberra-gtk3 wayland-devel libwayland-server \
             mesa-libEGL libxkbcommon-devel
(venv) $ sudo dnf upgrade --refresh
(venv) $ sudo dnf install git python3-devel \
             libcanberra-gtk3 fontconfig-devel freetype-devel \
             gtk3-devel libX11-devel libX11-xcb libXext-devel \
             libXfixes-devel libXi-devel libxkbcommon-devel \
             libxkbcommon-x11-devel libXrender-devel 'xcb-util*devel' \
(venv) $ sudo dnf upgrade --refresh

You can use a Python version other than the system default by replacing python3-devel with the -devel package matching the desired Python version. For example, to use Python 3.12, replace python3-devel with python3.12-devel.

Other distributions

If you're not using one of these, you'll need to work out how to install the developer libraries for python3, Qt's X11 dependencies, Qt's Wayland dependencies, and the executable canberra-gtk-play (and please let us know so we can improve this documentation!)

Installation

toga-qt must be installed directly using pip. The pyside6 optional extra is used to request the installation of the Python language bindings for Qt.

$ python -m pip install toga-qt[pyside6]

This will install the full PySide6 package, which includes both PySide6-Essentials and PySide6-Addons. The PySide6-Addons package is required to support the WebView widget. If your app does not use WebView, you can specify a requirement of toga-qt[pyside6-essentials] to only install the PySide6-Essentials package.

Implementation details

The toga-qt backend uses Qt 6.

The native APIs are accessed using the PySide6 bindings.