Answers for "how to use Qtimer in thread python"

1

how to use Qtimer in thread python

class DataCaptureThread(QThread):
    def collectProcessData(self):
        print ("Collecting Process Data")

    def __init__(self, *args, **kwargs):
        QThread.__init__(self, *args, **kwargs)
        self.dataCollectionTimer = QTimer()
        self.dataCollectionTimer.moveToThread(self)
        self.dataCollectionTimer.timeout.connect(self.collectProcessData)

    def run(self):
        self.dataCollectionTimer.start(1000)
        loop = QEventLoop()
        loop.exec_()
Posted by: Guest on November-24-2020

Code answers related to "how to use Qtimer in thread python"

Python Answers by Framework

Browse Popular Code Answers by Language