I'm trying to figure out how to insert a pyqt5 button into a python script and pause the script so it waits for the button press before it continues.
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.button.clicked.connect(pyfile.dothething)
self.ui.button2.clicked.connect(pyfile.dotheotherthing)
def do_the_stuff():
do some stuff
wait for button press
do_the_stuff()
the do_the_stuff() is going to ignore the button since normal python is not event based. How do I insert an event based wait function in the normal python script so it waits until the pyqt button is pressed?