Autocomplete not working for PyQt6-3D modules
Phil Thompson
phil at riverbankcomputing.com
Fri May 14 10:05:12 BST 2021
On 11/05/2021 17:59, Michael Gentili wrote:
> 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?
It will be fixed in the next releases.
Thanks,
Phil
More information about the PyQt
mailing list