Nov-30-2018, 02:35 PM
Thank you very much Alfalfa.
I was able to use your code to finally get mine to work.
Your example was so simple and straight forward with no ambiguity. Thank you again.
For the sake of completeness, here is a working version of the problem I posted in the beginning
I was able to use your code to finally get mine to work.
Your example was so simple and straight forward with no ambiguity. Thank you again.
For the sake of completeness, here is a working version of the problem I posted in the beginning
from PyQt5.QtWidgets import QApplication, QDialog from PyQt5 import QtCore from ThreadSignalUI import Ui_MainWindow import sys import time class WorkThread(QtCore.QObject): UpdateTextBoxSignal = QtCore.pyqtSignal(int) def __init__(self): super().__init__() @QtCore.pyqtSlot() def run(self): runningval = 0 while runningval < 10: runningval += 1 self.UpdateTextBoxSignal.emit(runningval) time.sleep(0.5) class ThreadSignal(Ui_MainWindow): def __init__(self, Application): Ui_MainWindow.__init__(self) self.setupUi(Application) self.worker = WorkThread() self.workerThread = QtCore.QThread() self.workerThread.started.connect(self.worker.run) self.worker.moveToThread(self.workerThread) self.worker.UpdateTextBoxSignal.connect(self.UpdateTextBoxFunction) self.StartButt.clicked.connect(self.StartThreading) def StartThreading(self, event): self.workerThread.start() def UpdateTextBoxFunction(self, value): self.TextBox.setText(str(value)) app = 0 app = QApplication(sys.argv) Application = QDialog() Program = ThreadSignal(Application) Application.show() app.exec_()