PySide6 Addons
PySide6-Addons is a complementary Python wheel providing bindings for a wide range of additional Qt 6 modules beyond the essentials, such as Qt3D, QtCharts, QtDataVisualization, QtMultimedia, QtWebEngineWidgets, and more. It is part of the official Qt for Python project, offering comprehensive access to the Qt 6 framework. Maintained by the Qt for Python team, it follows a regular release cadence, often aligning with new Qt versions.
Warnings
- breaking `QAction` has moved from `PySide6.QtWidgets` to `PySide6.QtGui` since PySide6.0. Applications migrating from PySide2 or older PySide6 versions need to update their imports.
- breaking Some enum type names changed from plural to singular (e.g., `Qt.ItemFlags` to `Qt.ItemFlag`). This primarily affected migrations from PyQt6 v6.0 to v6.1, but PySide6 has adopted the singular form since v6.0, meaning older code might break.
- deprecated The `setMargin()` method for `QLayout` objects has been deprecated. Use `setContentsMargins()` instead.
- gotcha When upgrading PySide6 (especially from 6.2.x to 6.3.0 and later), `ModuleNotFoundError` can occur for modules that are now part of `pyside6-essentials` or `pyside6-addons`. This is often due to residual files from previous installations or cache issues.
- gotcha Users on Linux might encounter 'Could not load the Qt platform plugin "xcb"' errors after PySide6 upgrades (e.g., to 6.5), indicating a missing system dependency.
- gotcha Importing `QtWebEngineWidgets` (part of `pyside6-addons`) on Windows can sometimes result in `ImportError: DLL load failed while importing QtWebEngineWidgets: The specified module could not be found.` This often points to environmental conflicts or missing runtime components.
- breaking The minimum supported Python version for PySide6 and its addons has been raised to Python 3.10.
Install
-
pip install pyside6-addons -
pip install pyside6
Imports
- QWebEngineView
from PySide6.QtWebEngineWidgets import QWebEngineView
- QChartView
from PySide6.QtCharts import QChartView
- QMediaPlayer
from PySide6.QtMultimedia import QMediaPlayer
- Q3DScene
from PySide6.Qt3DCore import Q3DScene
Quickstart
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from PySide6.QtCharts import QChartView, QLineSeries
from PySide6.QtCore import QPointF
class ChartWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("PySide6 Addons: QtCharts Example")
self.setGeometry(100, 100, 600, 400)
series = QLineSeries()
series.append(QPointF(0, 6))
series.append(QPointF(2, 4))
series.append(QPointF(3, 8))
series.append(QPointF(7, 4))
series.append(QPointF(10, 5))
chart = QChartView()
chart.chart().addSeries(series)
chart.chart().createDefaultAxes()
chart.chart().setTitle("Simple Line Chart")
central_widget = QWidget()
layout = QVBoxLayout(central_widget)
layout.addWidget(chart)
self.setCentralWidget(central_widget)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = ChartWindow()
window.show()
sys.exit(app.exec())