When will there be a new version of Creating GUI Applications for PyQt6 and PySide6?

Heads up! You've already completed this tutorial.

It's out now! Get the PyQt6 Edition or PySide6 Edition

I'm currently in the process of updating my book Creating GUI Applications with Python and QT for the Qt6 releases of Qt. While these new versions are largely backwards compatible with Qt5 there are a number of signficant differences which will cause issues when migrating.

We now also have migration guides for moving from PyQt5 to PyQt6 or PySide2 to PySide6.

One major difference only applies to PyQt6: Riverbank Software have removed QResource support from PyQt6. If you have no idea what that is, don't worry, you're not alone. The QResource System is used to manage application resources -- think images, icons, stylesheets -- from within Qt Designer. By compiling these resources into Python code they could be used directly from within the application without needing to worry about paths.

If this sounds pretty useful it is, but it's not commonly used: probably because managing the assets in Qt Designer isn't particularly friendly.

Some other thoughts from the migration --

  • PyQt6 is less directly source-compatible with PyQt6 than PySide6. In PyQt6 the namespaces have been moved under Python Enums so e.g. Qt.DisplayRole is now under Qt.ItemDataRole.DisplayRole. The same structure exists now in PySide6, but the old locations are retained, so it's backwards compatible Qt.ItemDataRole.BackgroundRole == Qt.BackgroundRole. I'm 50/50 on whether to use the new style in the PySide6 book -- thoughts?
  • (PyQt6 & PySIde6) QAction is now in QtGui not QtWidgets. This always caught me out (since it's not a widget) so I think it's a good change. But it's hard to auto-migrate.
  • (PyQt6 & PySIde6) Retrieving a pixmap now seems to return a copy: if you get a labels pixmap and draw on it, it doesn't affect the widget. Required a rewrite of the custom widget code. May be missing something here, early days.
  • (PyQt6) QMouseEvent now doesn't have .x() or .y() which is odd. You need to get a position via QMouseEvent.position() instead.

In addition in PySide6.1, the following functions are all deprecated:

Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PyQt6 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

python
QEnterEvent.globalPos()
QEnterEvent.globalX()
QEnterEvent.globalY()
QEnterEvent.localPos()
QEnterEvent.pos()
QEnterEvent.QEnterEvent.screenPos()
QEnterEvent.QEnterEvent.windowPos()
QEnterEvent.QEnterEvent.x()
QEnterEvent.QEnterEvent.y()

It is still early days, and it's quite possible I'll find more incompatibilities as I dig further. The next version of the book should be out, at least in an "early access" form, by next week.

For an up to date migration guide see PyQt5 to PyQt6 or PySide2 to PySide6.

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

When will there be a new version of Creating GUI Applications for PyQt6 and PySide6? was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.