I use the Spyder IDE (5.1)
I have an app structured like so. Basically, the app UI contains a button and when that button is clicked it triggers the function button1 which prompts the user for input and then calls func1 and func2 to do something to the input
The issue is I sometimes want to debug code and need to see the variables changing in func1 or func2 but those functions as well as button1 function aren't called until the button is pressed. The debugger reaches the end of the code before the UI window even appears (the window doesn't seem to appear until sys.exit(app.exec_()) )
I'm not super experienced with the debugger. How do you debug code structured like this with a UI?
def button1(self):
def func1(input):
*Do something*
return
def func2(input):
*Do something*
return
input=QFileDialog().getOpenFileName(self, "Select Input","","Excel (*.xlsx)")
func1(input)
func2(input)
return
class Window(QMainWindow):
def __init__(self):
*UI layout*
self.Button1=QPushButton("Button1")
self.Button1.setStyleSheet("background-color: green")
self.Button1.clicked.connect(lambda: button1(self))
layout.addWidget(self.Button1)
if __name__ == "__main__":
app = QApplication(sys.argv)
QApplication.setStyle("Fusion")
mainWin = Window()
mainWin.show()
sys.exit(app.exec_())