PySide is in the interesting position of being both Qt (with its C++ roots and all that entails) but also distinctly Python. Where possible, we strive to align PySide further with Python conventions and use as many Python features as we can, if they make sense.
Quote below:
The new Enum system
One such area that we tackled now affects enums, which was implemented as bound C++ classes, but now it is updated to leverage Python's own enum mechanism.
Although the new Python enums and the old Shiboken-based ones are compatible with each other, but there are a few differences or restrictions:
Python enums cannot be inherited from each other, whereas Shiboken enums can
Python enums do not allow undefined values, Shiboken enums do
Python enums always need exactly one argument, Shiboken enums have a default zero value
Python enums rarely inherit from int, Shiboken enums always do
You can see that some of these differences are between flags. For example, until now, you could either write
These shortcuts, and flags no longer exist (officially) from 6.4.0 onwards. Instead, Python has an enum.Flags class, which is a subclass of the enum.Enum class.
If the thought of updating all your code left and right makes you sweat more than an overheated pumpkin spice latte, do not fret, for salvation has a name, and it’s “forgiveness mode”. This transitory mode allows you to continue using the old constructs but translates them internally into the new ones. For example, if you write
Traceback (most recent call last):
File "", line 1, in
File "C:\Python311\Lib\site-packages\matplotlib_init_.py", line 1182, in get_backend
return rcParams['backend']
~~~~~~~~^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\matplotlib_init_.py", line 677, in getitem
plt.switch_backend(rcsetup.auto_backend_sentinel)
File "C:\Python311\Lib\site-packages\matplotlib\pyplot.py", line 252, in switch_backend
switch_backend(candidate)
File "C:\Python311\Lib\site-packages\matplotlib\pyplot.py", line 265, in switch_backend
backend_mod = importlib.import_module(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Python311\Lib\site-packages\matplotlib\backends\backend_qtagg.py", line 12, in
from .backend_qt import QtCore, QtGui, _BackendQT, FigureCanvasQT
File "C:\Python311\Lib\site-packages\matplotlib\backends\backend_qt.py", line 72, in
_MODIFIER_KEYS = [
^
File "C:\Python311\Lib\site-packages\matplotlib\backends\backend_qt.py", line 73, in
(_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'
Activity
tacaswell commented on Nov 1, 2022
Thank you for the report. The patch to work around the breaking change in pyside6 will be released in mpl 3.6.2
Duplicate of #24155 and fixed in #24158