Differences between PyQt5 and PyQt6

PyQt is a Python GUI Framework used for the creation of GUI, Graphical User Interfaces. In January 2021, PyQt6 was introduced (Version 6), which brought in several changes and improvements. In this article, we are going to discuss the differences between PyQt6 and its predecessor PyQt5.

Overview of the changes

PyQt is a Python Binding of the Qt Framework in C++. Changes and updates made to Qt are also reflected in PyQt. It thus makes sense, that the changelog for the Qt 6.0 framework will also tell us about the new changes in PyQt6.

From official sources, here are the key changes in Qt 6.0:

  • Leveraging features from the new C++17 Standard
  • Next generation QML (Qt Modeling Language)
  • New graphics architecture
  • Unified 2D and 3D for Qt Quick
  • CMake build system (with qmake still supported for applications)
  • Various Misc. improvements.

Main Differences

Note: For PyQt6, Python v3.6.1 or later is required. Older versions are no longer supported.

Name Changes

The exec_() and print_() methods have been removed entirely from PyQt6.

The .exec() method in Qt starts the event loop of your QApplication or dialog boxes. In Python 2.7, exec was a reserved keyword, meaning that it could not be used as a variable name, a function name, or a method name. In earlier versions of PyQt the method was renamed as .exec_() adding a trailing underscore to avoid a naming conflict.

The reason behind this change is that Python 3.0 removed the exec keyword, freeing up the name to be used. And since PyQt6 supports only Python 3.x versions, the underscored names have been removed. These were previously deprecated in PyQt5, and the .exec() method will work there too (they are backwards compatible).

Enums and SubClasses

PyQt6 made some significant changes when it came to where the Enums for various classes were stored. Enums are now categorized under other Enums, and require the full name in order to access them.

For example, the Alignment Flags like AlignRight and AlignCenter are now stored under the AlignmentFlag Enum.

In PyQt5, we would access them as follows.


In PyQt6, we need to specify the full name as shown below.


However, just like the .exec() and .print() name changes, these changes are fully backward compatible. The full names for Enums will also work in PyQt5. This has the benefit of allowing you to make these changes in your PyQt5 application before porting it over to PyQt6.

No more QResources

PyQt6 has removed support for Qt’s Resource Framework. For packaging data files with your applications, you can use PyInstaller’s data file support.

QAction moved

In PyQt6, the QAction class used for the creation toolbars and menus, has been relocated from the QtWidgets module to the QtGui module.

High DPI Scaling

The high DPI (dots per inch) scaling attributes:

Qt.AA_DisableHighDpiScaling and,
have been deprecated because high DPI setting is the default setting in PyQt6. This cannot be disabled.

License Changes

The bindings for the (GPL licensed) Qt classes that implement support for network authorization have moved out to a separate add-on project PyQt6-NetworkAuth. This means that all of the libraries wrapped by PyQt6 itself are licensed under the LGPL.

  • pylupdate6 is a completely new pure-Python implementation. It can no longer read a .pro file in order to determine the names of .py files to translate.
  • Support for the Qt resource system has been removed (i.e: there is no pyrcc6).

Other Misc. Changes:

qApp, which we would use to return the current QApplication Instance, has been removed.

The PYQT_CONFIGURATION dict has been removed.

Qt.MidButton has been renamed to Qt.MiddleButton

Platform-specific methods in the QtWin and QtMac modules have been deprecated. Native calls are now being used instead.

QRegExp has been replaced by QRegularExpression.

QDesktopWidget has been removed from PyQt6. You can use QScreen as an alternative.


So what does this mean for us? Well, as you may have already noticed, there isn’t a phenomenal difference between PyQt5 and PyQt6. Most of the changes are fairly minor, with several of them even being backwards compatible with PyQt5.

If you ae currently using PyQt5, then there is no obligation on you to upgrade. You won’t be missing out on much. Will you eventually have to upgrade? Yes, that is a given. All things move forward, and eventually PyQt5 will no longer be an ideal option.

On the other hand, if you are a new comer to the PyQt Series, start of directly with PyQt6. You won’t be losing out on anything. You can start off directly with PyQt6 right here, with our very own PyQt6 tutorial series!

This marks the end of the “Differences between PyQt5 and PyQt6” Comparison. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the tutorial content can be asked in the comments section below.

Notify of
Inline Feedbacks
View all comments