Autocomplete not working for PyQt6-3D modules

Michael Gentili gentili at mcpnet.ca
Tue May 11 17:59:26 BST 2021


I am using Visual Studio Code with the Python (Pylance) extension to provide autocomplete services.  

My environment is configured like so:

Python 3.9.1
PyQt6==6.0.3
PyQt6-3D==6.0.3
PyQt6-3D-Qt6==6.0.2
PyQt6-Qt6==6.0.2
PyQt6-sip==13.0.1

The following simple script runs fine and both pylance and pylint find no problems with it:

-------------------
from PyQt6.Qt3DExtras import Qt3DWindow
from PyQt6.QtWidgets import QApplication

app = QApplication([])

view = Qt3DWindow()
view.show()

app.exec()
-------------------

However autocomplete is not picking up correct type information for everything under the PyQt6-3D module.  In the above example, the QApplication object will produce autocomplete suggestions, but the Qt3DWindow object will not.

I believe it has something to do with the structure of the pyi files for the PyQt modules.  The pyi files for the regular PyQt6 modules have their class definitions at the top level, while the pyi files for the PyQt6-3D modules have nested definitions:

# QtWidgets.pyi
class QApplication(QtGui.QGuiApplication):

# Qt3DExtras.pyi
class Qt3DExtras(PyQt6.sip.simplewrapper):

    class QAbstractCameraController(Qt3DCore.QEntity):

So I can still write working code, but the lack of autocomplete makes the process very painful.

Anyone have any experience or understanding of what’s going on here?

Michael Gentili
MCP INC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210511/31ff7654/attachment.htm>


More information about the PyQt mailing list