Only local variables from main script are loaded when running python script in Debug
Unsolved
Qt for Python
-
Hello!!
I am configuring a simple python project in QtCreator.
While debugging an application that has more than one script, if a step into a code that is not in the main script, local variables are not loaded and I couldnt find any extra configuration easily on documentation.
For example: the code below on main is the main script and widget.py is used. If I activate a breakpoint in the last line of the method inside on_pushButton_clicked slot, Qt Creator does not load the variables on local debugger panel. Using VSCode is possible to debug all the variables.Did anybody have the same issue?
I am using the python interpreter in a virtual environment, using python 3.10.9 and PySide6 == 6.5.2
Files main.py (executed code):
import sysfrom PySide6.QtWidgets import QApplication from widget import Widget if __name__ == "__main__": app = QApplication(sys.argv) widget = Widget() widget.show() sys.exit(app.exec())
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout, QLabel, QPushButton from PySide6.QtCore import QRandomGenerator, Slot class Widget(QWidget): def __init__(self, parent=None): super().__init__(parent) self.resize(320, 49) self.horizontalLayout = QHBoxLayout(self) self.horizontalLayout.setObjectName(u"horizontalLayout") self.label = QLabel("Teste", self) self.horizontalLayout.addWidget(self.label) self.pushButton = QPushButton("Click here", self) self.horizontalLayout.addWidget(self.pushButton) self.pushButton.clicked.connect(self.on_pushButton_clicked) @Slot() def on_pushButton_clicked(self): number = str(QRandomGenerator.global_().generate()) self.label.setText("Teste " + number)