Overview
PySide6 6.0, released on January 11, 2021, is the official Qt for Python binding for Qt 6. Maintained by the Qt Company, it offers an LGPL-licensed alternative to PyQt6.
Main Features
Official Qt 6 binding
PySide6 provides access to all Qt 6 modules: QtWidgets, QtQuick, Qt3D, QtCharts, and many more. The API is very close to PyQt6 but uses slightly different naming conventions for certain utilities (such as signal/slot tools).
python
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
from PySide6.QtCore import Slot
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('PySide6 - Demo')
button = QPushButton('Click me')
button.clicked.connect(self.on_click)
self.setCentralWidget(button)
@Slot()
def on_click(self):
self.statusBar().showMessage('Button clicked!')
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())
Tools and compatibility
PySide6 includes tools like pyside6-uic to compile .ui files and pyside6-rcc for resources. A porting tool pyside6-port helps migrate code from PySide2.
python
# Compile a .ui file created with Qt Designer
# pyside6-uic form.ui -o ui_form.py
# Using the generated file
from PySide6.QtWidgets import QApplication, QWidget
# from ui_form import Ui_Form
class MyForm(QWidget):
def __init__(self):
super().__init__()
# self.ui = Ui_Form()
# self.ui.setupUi(self)
# Migrate from PySide2:
# pyside6-port my_application.py
