In November 2019, I wrote about this:
Qt for Python (and plotting with Matplotlib)
Since then, Qt 6 and PySide6 has been released (see Qt for Python 6 released). Currently, I install both Python and Qt on my Mac with Homebrew, making the steps much easier than described in the post from 2019:
brew install qt
brew install python
At the moment, Homebrew does not install Python 3.10, the latest and greatest version of Python, as default. Since I prefer Python 3.10, I install Python in this way:
brew install firstname.lastname@example.org
brew unlink email@example.com
brew link --force firstname.lastname@example.org
The midle step is only necessary if you already installed Python (version 3.9) with Homebrew. The final step is to install PySide6 with pip:
To update your code for PySide6 is, in most cases, straight forward: just replace all references to the module
PySide6. See Porting Applications from PySide2 to PySide6 for details. PyQt6 is an alternative mapping the Qt bindings to Python, but I use PySide6 since it is officially adopted (and supported) by Qt. Some more information about their differences here: PyQt6 vs PySide6.
Finally, I have updated the Matplotlib example from the 2019 post using PySide6:
qt-matplotlib.py (pretty print HTML version).
See also the PySide6 edition of the book Create GUI Applications with Python & Qt from Martin Fitzpatrick and Matplotlib's Embedding in Qt.