class _Date_Thread(QThread):
def run (self, param): # Where the parameter should be entered
while True:
print(param)
time.sleep(0.1)
class Ui_MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.th = _Date_Thread()
self.th.start()
I know that QThread is executed in this way, but how do I specify the parameters of the function to be executed in QThread?
pyside2 python pyqt thread qthread
class _Date_Thread(QThread):
def __init__(self, param):
self.param = param
def run(self): # Where the parameter should enter
while True:
print(self.param)
time.sleep(0.1)
class Ui_MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.th = _Date_Thread(param)
self.th.start()
I can do it like this.
© 2024 OneMinuteCode. All rights reserved.