I tried implementing the suggestion from subprocess Popen blocking PyQt GUI but it appears that the onFinished function is never getting invoked.
class MyApp(QtWidgets.QMainWindow, Ui_MainWindow):
[...]
def Run_PnL_Script(self):
self.Run_PnL.setEnabled(False)
self.Run_PnL.setStyleSheet("background-color: #D3D3D3; color: #FFFFFF")
self.PnL_Status.setText("Running...")
process = QtCore.QProcess(self)
process.finished.connect(self.onFinished)
process.startDetached("cmd.exe", ["/c", "K:\Market Risk\Risk App\Batches\RTest.bat"])
def onFinished(self, exitCode, exitStatus):
self.PnL_Status.setText("Complete.")
self.Run_PnL.setEnabled(True)
self.Run_PnL.setStyleSheet("background-color: #4582EC; color: #FFFFFF")
[...]
Thanks in advance for the help.