QAxWidget not working on PyQt6
Phil Thompson
phil at riverbankcomputing.com
Mon Oct 6 11:07:35 BST 2025
On 06/10/2025 07:44, Lukas Lang wrote:
> Hi,
>
> I am running into an issue trying to use QAxWidget in PyQt6:
>
> import sys
> from PyQt6.QAxContainer import QAxWidget
> from PyQt6.QtWidgets import QApplication, QMainWindow
>
> class MyWindow(QMainWindow):
> def __init__(self):
> super().__init__()
>
> self.ax = QAxWidget("Shell.Explorer.2") # other ActiveX
> controls are also broken
>
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> window = MyWindow()
> window.show()
> sys.exit(app.exec())
>
> Trying to run this in Python 3.13.7 with only PyQt6 installed, I get
> "Cannot mix incompatible Qt library (6.9.0) with this library
> (6.9.2)". Replacing PyQt6 in the imports with PyQt5 works as expected
> on the other hand (after installing PyQt5 of course). Am I doing
> something wrong, or is there a problem with the pre-built binaries?
QAxWidget does not guarantee backwards binary compatibility between Qt
releases. These days I always build the wheels against the corresponding
.0 version of Qt. Hopefully if you pin the version of PyQt6-Qt6 to
v6.9.0 it should work.
Phil
More information about the PyQt
mailing list