I have the following problem:
after clicking the button in the PyQt GUI, I have to do two things:
- Update QTextBrowser Immediately
- Run a method that will wait a while and activate some buttons after.
I get that 1 and 2 are executed at the same time, after a waiting period.
Code Part:
signalUpdateProgressDialog = QtCore.pyqtSignal(str)
self.btnStopOpt.clicked.connect(self.clickStop1)
self.btnStopOpt.clicked.connect(self.clickStop)
def updateProgressDialog(self, dialog):
self.ProgressDialog.setHtml(dialog)
def clickStop1(self):
self.signalUpdateProgressDialog.emit('Message')
def clickStop(self):
print "Thread Stopped"
time.sleep(5)
self.btnRun.setEnabled(True)
I tried everything in one clickStop method, I tried with and without signal allocation for updateProgress. Always, the GUI is updated only after a waiting period.
However, I ran into this problem before, I think I donβt understand how this works with the GUI. In general, how to get the required behavior: is the GUI updated when a line of code is executed?
source
share