A minimal PySide2 GUI demo for Windows 11 and Ubuntu Linux 24.04: a window containing one big "Hello world!" button. It is the smallest complete Qt application in Python — the starting point for any PySide2 project. The Qt platform-plugin path is set explicitly in the code, which avoids the "could not find or load the Qt platform plugin" error some environments produce.

 

Important: PySide2 ships wheels for Python 3.7 to 3.10 only. Install one of those Python versions before running 01_venv_create; a newer Python needs the code ported to PySide6.

 

[Folder Structure]

  • CLAUDE.md / AGENT.md: program specification (identical content).
  • CHANGELOG.md: change log.
  • copyright.txt: copyright notice.
  • src/: the demo, the launcher scripts, and this document.
  • venv/: Python virtual environment, created by step 1.

[Prerequisites]

  • Operating system: Windows 11 or Ubuntu Linux 24.04.
  • Python 3.7 to 3.10 — required by PySide2, which publishes no wheels for newer versions.
  • Python packages: PySide2 (installed automatically by step 1).
  • A display is required, because the example opens a window. No GPU needed.

[Instructions]

Step 1: Create the virtual environment

Create the virtual environment and install src/requirements.txt (PySide2). Make sure the active Python is version 3.7 to 3.10 first, or the PySide2 install will fail.

 

Windows 11:

src\01_venv_create.bat

Ubuntu Linux 24.04:

bash src/01_venv_create.sh

Step 2: Activate the virtual environment

Activate the environment in the current shell. On Linux you must source the script so the activation stays in effect after it finishes.

 

Windows 11:

src\02_venv_activate.bat

Ubuntu Linux 24.04:

source src/02_venv_activate.sh

Step 3: Show the window

Run the demo. A window opens with a single large "Hello world!" button. Close the window to end the program.

 

Windows 11:

src\03_pyside2_hello.bat

Ubuntu Linux 24.04:

bash src/03_pyside2_hello.sh

Step 4: Remove the virtual environment

When you are finished, delete the venv/ folder to free up disk space. Re-run step 1 whenever you need the environment again.

 

Windows 11:

src\99_venv_clear.bat

Ubuntu Linux 24.04:

bash src/99_venv_clear.sh

[Usage Notes]

  • PySide2 ships wheels for Python 3.7 to 3.10 only — install one of those Pythons before 01_venv_create; a newer Python needs a port to PySide6.
  • Every Qt program follows the same three steps: create the application object, create and show the window, then start the event loop that waits for the user.
  • PySide2 is the official Qt for Python binding under the LGPL; PyQt5 has almost the same API but a different licence.
  • The example needs a real desktop: over SSH without X forwarding, or in a container with no display, Qt cannot open a window.

This SDK is built in AppForAI - AI Dev Tools.

 

Purchase license separately:  USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.