Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Only local variables from main script are loaded when running python script in Debug
Forum Updated to NodeBB v4.3 + New Features

Only local variables from main script are loaded when running python script in Debug

Scheduled Pinned Locked Moved Unsolved Qt for Python
pysideqt for python
1 Posts 1 Posters 201 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    afcarvalho
    wrote on 11 Sept 2023, 17:08 last edited by
    #1

    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 sys

    from PySide6.QtWidgets import QApplication
    from widget import Widget
    
    
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        widget = Widget()
        widget.show()
        sys.exit(app.exec())
    

    widget.py

    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)
    
    1 Reply Last reply
    0

    1/1

    11 Sept 2023, 17:08

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved