Details
-
Suggestion
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.3.0
-
None
Description
I'm using PySide version 6.3.0 and in this version if you are using a static type checker, e.g., pyright, and access a member variable like "clicked", you will get a bunch of false positive errors saying the member variable doesn't exist.
Here is an example code:
import sys from PySide6 import QtCore, QtWidgets, QtGui class HelloWorld(QtWidgets.QWidget): def __init__(self): super().__init__() self.button = QtWidgets.QPushButton("Push me!") self.button.clicked.connect(self.magic) @QtCore.Slot() def magic(self): print("magic") def run(): app = QtWidgets.QApplication() widget = HelloWorld() widget.setWindowTitle("Hello World!") widget.resize(500, 500) widget.show() sys.exit(app.exec())
And the output of pyright:
No configuration file found. pyproject.toml file found at /home/labatata/Code/Python/tim-gui. Loading pyproject.toml file at /home/labatata/Code/Python/tim-gui/pyproject.toml Pyproject file "/home/labatata/Code/Python/tim-gui/pyproject.toml" is missing "[tool.pyright]" section. stubPath /home/labatata/Code/Python/tim-gui/typings is not a valid directory. Assuming Python platform Linux Searching for source files Found 1 source file /home/labatata/Code/Python/tim-gui/tim_gui/gui/__init__.py /home/labatata/Code/Python/tim-gui/tim_gui/gui/__init__.py:16:21 - error: Cannot access member "clicked" for type "QPushButton" Member "clicked" is unknown (reportGeneralTypeIssues) 1 error, 0 warnings, 0 informations Completed in 2.1sec
I think the solution here would be to expose these members variables in the stub files.
Attachments
Issue Links
- relates to
-
PYSIDE-1713 SignalInstance emit signatures incorrect
- Closed