Docker container python3 with qt6 pyside6

Hi,

I have a question about my system. Here is a summary of the software on my system:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.119-7.5.0-devel-ge5c5595adb06 #1-Torizon SMP PREEMPT Mon Jan  5 09:23:13 UTC 2026
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/0597b6a8bbc8f75687ef4e18e63a0385625ea6359d301e39ad7acea1052b1853/0
Distro name:              NAME="Torizon OS"
Distro version:           VERSION_ID=7.5.0-devel-20260116151302-build.0
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mp-15603379
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Mallow Board
Toradex version:          0064 V1.1A
Serial number:            15603379
Processor arch:           aarch64
------------------------------------------------------------

I compiled my project starting from the Yocto Project Torizon 7.5. Inside the system, I run two Docker containers:

torizon@verdin-imx8mp-15603379:~$ docker ps
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                    PORTS     NAMES
37c47e4f2cd5   torizon/qt6-wayland-examples-vivante:3   "/usr/lib/aarch64-li…"   20 minutes ago   Up 20 minutes                       qt6-demo
406d5b2eecb9   torizon/weston-imx8:4                    "/usr/bin/entry.sh -…"   20 minutes ago   Up 20 minutes (healthy)             weston

I ran the two containers following the instructions in your guide and everything works correctly. On the display connected to the system, I see a demo of a calculator. I wanted to know if there is, or if it is possible to have, a container that works with PySide6, which is the Python version of Qt6, ready to use.

This is my simple example:

import sys
import math

from PySide6.QtWidgets import (
    QWidget,
    QApplication,
    QLabel,
    QVBoxLayout
)
from PySide6.QtGui import (
    QPainter,
    QColor,
    QMouseEvent,
    QImage,
    QPen,
    QBrush
)
from PySide6.QtCore import Qt, QPointF


class ModernColorWheel(QWidget):

    def __init__(self):
        super().__init__()

        self.setFixedSize(450, 550)
        self.radius = 200
        self.center = QPointF(self.width() / 2, self.radius + 30)
        self.cursor_pos = QPointF(self.center)

        # Label colore selezionato
        self.color_label = QLabel()
        self.color_label.setFixedSize(200, 50)
        self.color_label.setStyleSheet("""
            QLabel {
                background-color: #FFFFFF;
                border-radius: 10px;
                border: 2px solid #AAA;
            }
        """)

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 30)
        layout.addStretch()
        layout.addWidget(
            self.color_label,
            alignment=Qt.AlignHCenter | Qt.AlignBottom
        )

        self.wheel_image = self.create_color_wheel(
            self.radius * 2,
            self.radius * 2
        )

    # Creazione ruota colori
    def create_color_wheel(self, width, height):

        image = QImage(width, height, QImage.Format_ARGB32)
        cx = width / 2
        cy = height / 2

        for x in range(width):
            for y in range(height):
                dx = x - cx
                dy = y - cy
                r = math.hypot(dx, dy)

                if r <= self.radius:
                    angle = math.degrees(math.atan2(dy, dx))
                    if angle < 0:
                        angle += 360

                    sat = int((r / self.radius) * 255)
                    color = QColor()
                    color.setHsv(int(angle), sat, 255)
                    image.setPixelColor(x, y, color)
                else:
                    image.setPixelColor(x, y, QColor(0, 0, 0, 0))

        return image

    # Paint event
    def paintEvent(self, event):

        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)

        painter.fillRect(self.rect(), QColor(30, 30, 30))

        painter.drawImage(
            int(self.center.x() - self.radius),
            int(self.center.y() - self.radius),
            self.wheel_image
        )

        painter.setPen(QPen(Qt.white, 3))
        painter.setBrush(QBrush(Qt.black))
        painter.drawEllipse(self.cursor_pos, 10, 10)

        painter.setPen(Qt.NoPen)
        painter.setBrush(QColor(0, 0, 0, 100))
        painter.drawEllipse(self.cursor_pos + QPointF(2, 2), 10, 10)

    # Mouse press
    def mousePressEvent(self, event: QMouseEvent):
        self.update_cursor(event.position())

    # Mouse move
    def mouseMoveEvent(self, event: QMouseEvent):
        if event.buttons() & Qt.LeftButton:
            self.update_cursor(event.position())

    # Update cursore
    def update_cursor(self, pos: QPointF):

        dx = pos.x() - self.center.x()
        dy = pos.y() - self.center.y()
        r = math.hypot(dx, dy)

        if r > self.radius:
            dx = dx * self.radius / r
            dy = dy * self.radius / r

        self.cursor_pos = QPointF(
            self.center.x() + dx,
            self.center.y() + dy
        )
        self.update()

        angle = math.degrees(math.atan2(dy, dx))
        if angle < 0:
            angle += 360

        sat = int((math.hypot(dx, dy) / self.radius) * 255)
        color = QColor()
        color.setHsv(int(angle), sat, 255)

        self.color_label.setStyleSheet(f"""
            QLabel {{
                background-color: {color.name()};
                border-radius: 10px;
                border: 2px solid #AAA;
            }}
        """)


# MAIN
if __name__ == "__main__":

    print("Start demo")
    app = QApplication(sys.argv)
    window = ModernColorWheel()
    window.setWindowTitle("Color Wheel")
    window.show()
    sys.exit(app.exec())

I have no idea how to make it work correctly on the system.

Thanks for the help.
Fabio

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


I can see you’re running Torizon OS 7.5.0-devel on a Verdin iMX8M Plus with Docker containers and want to run a PySide6 application (1).

Understanding Your Current Setup

Your system is already running the graphical stack correctly with Weston and Qt6 containers (1). Torizon OS uses Docker containers for application development, which provides modularity and scalability benefits (1).

PySide6 Container Approach

While the sources don’t show a ready-made PySide6 container specifically, Toradex provides Debian-based container images that can serve as starting points for custom applications (1). These containers include the necessary group permissions to access hardware peripherals and recommended software packages for execution on Toradex modules (1).

Development Path Forward

For your PySide6 application, you would need to:

  1. Create a custom container based on Torizon’s Debian containers that includes PySide6 dependencies
  2. Use the existing Weston container as your graphical backend (which you’re already running successfully)
  3. Integrate with the container ecosystem that Torizon provides for GUI applications (1)

The documentation shows that Torizon supports hardware acceleration, graphical user interfaces, and various frameworks in containers (2). Your approach of using Docker containers aligns with Torizon’s modern development architecture (1).

Development Tools

Toradex provides a Visual Studio Code extension specifically for Torizon OS development (1). This extension includes remote debugging capabilities and integration with CI/CD toolchains, which could help you develop and deploy your PySide6 application (2).

Since you’re already successfully running Qt6 and Weston containers, you have the foundation needed. You’ll need to create a custom Dockerfile that builds upon Toradex’s Debian base images and includes the PySide6 Python packages.

Best regards,
Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Greetings @fmolon,

We don’t currently have a supported template for a Pyside6 container. However, it should be possible.

We had a proof of concept done for another customer in this repository here: GitHub - danielsore/torizon-update-supervisor: Proof of concept UI for monitoring and controlling OTA updates on Torizon OS using the Aktualizr D-Bus API, including user consent, progress visualization, and reboot handling.

Now what the proof of concept is about is not important for your case here. What is important is that this proof of concept has a GUI that made with Pyside6. This folder of the repository has the source code for the GUI, including a Dockerfile: torizon-update-supervisor/update-supervisor-poc at main · danielsore/torizon-update-supervisor · GitHub

Perhaps you can use this as a reference to get a basic GUI going on your end.

Best Regards,
Jeremias

Thanks for your reply. I’m thinking of a possible solution: can we start from the Wayland Base Vivante (torizon/wayland-base-vivante:3.5.0) Docker image and install Python3 along with PySide6 libraries?

Thanks

Fabio

can we start from the Wayland Base Vivante (torizon/wayland-base-vivante:3.5.0)

Why do you specifically want to use this version of the container image?

In your original post it looks like you’re on Torizon OS 7.X. Our container images with a 3.X tag are meant for the older 6.X Torizon OS. For Torizon OS 7.X you want 4.X container tags.

Is there a reason you can’t use use a similar Dockerfile to what is in the repository I shared earlier?

Best Regards,
Jeremias

Hi @jeremias.tx,

I saw on this link torizon/wayland-base-vivante - Docker Image that the latest available version is 3.5.0. When I pull the Docker image, I run the following command:

docker pull torizon/wayland-base-vivante:3.5

Is this the correct command to get the latest version of wayland-base-vivante, or am I making a mistake?

Thanks for the help

Fabio

Between Torizon OS 6.X and Torizon OS 7.X the naming scheme for container images has changed. Instead of torizon/wayland-base-vivante you now want to be using torizon/wayland-base-imx8: torizon/wayland-base-imx8 - Docker Image

This is the equivalent for Torizon OS 7.X.

Best Regards,
Jeremias

Ok thansk, i will use torizon/wayland-base-imx8 for build my pyside6 project.

Fabio

Glad we were able to help.

Best Regards,
Jeremias