SuperQT
SuperQT is a collection of missing widgets and components that extend the capabilities of PyQt and PySide for building rich graphical user interfaces. It provides a variety of useful classes, from advanced sliders and combo boxes to utility functions for array conversion and signal blocking. The current version is 0.8.1, with frequent minor releases to add features and fix bugs, typically on a monthly basis.
Common errors
-
ModuleNotFoundError: No module named 'PyQt6'
cause A required Qt binding (PyQt6, PySide6, or PyQt5) was not installed.fixInstall a Qt binding, e.g., `pip install PyQt6` or `pip install PySide6`. -
AttributeError: module 'superqt' has no attribute 'QLabeledSlider'
cause Attempted to import a superqt widget directly from the top-level `superqt` module instead of its specific submodule.fixImport the widget from its correct submodule, e.g., `from superqt.sliders import QLabeledSlider`. -
TypeError: 'builtin_function_or_method' object is not subscriptable (when using QRangeSlider)
cause In older versions, `QRangeSlider` might have had issues with direct tuple assignment for `setRange` or `setValue`.fixEnsure you are on a recent version of superqt (>=0.7.7 fixed some range slider issues) and explicitly pass two arguments to `setRange(min, max)` and `setValue(min_val, max_val)`.
Warnings
- breaking SuperQT v0.8.0 dropped support for Python 3.9 and PySide2. Users on these versions must upgrade their Python environment or switch to a different Qt binding like PyQt5, PyQt6, or PySide6.
- gotcha SuperQT does NOT install a Qt binding for you. You must explicitly install one (e.g., PyQt6, PySide6, PyQt5) for superqt to function.
- gotcha Many superqt components are organized into specific submodules (e.g., `superqt.sliders`, `superqt.widgets`, `superqt.combobox`). Importing directly from `superqt` will often result in an `AttributeError`.
Install
-
pip install superqt PyQt6 -
pip install superqt PySide6 -
pip install superqt PyQt5
Imports
- QLabeledSlider
from superqt import QLabeledSlider
from superqt.sliders import QLabeledSlider
- QToggleSwitch
from superqt import QToggleSwitch
from superqt.widgets import QToggleSwitch
- QSearchableComboBox
from superqt import QSearchableComboBox
from superqt.combobox import QSearchableComboBox
- qt_signals_blocked
from superqt.utils import qt_signals_blocked
Quickstart
import sys
from superqt.sliders import QLabeledSlider
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QWidget()
layout = QVBoxLayout()
slider = QLabeledSlider()
slider.setRange(0, 100)
slider.setValue(50)
layout.addWidget(slider)
w.setLayout(layout)
w.setWindowTitle("SuperQT Labeled Slider Example")
w.show()
sys.exit(app.exec())