创建一个继承自QThread的子类,并重写其run()方法,在run()方法中编写需要在子线程中执行的任务。 from PyQt5.QtCore import QThread class MyThread(QThread): def __init__(self): super().__init__() def run(self): # 执行耗时任务 pass 复制代码 在主线程中实例化这个子类,并调用start()方法启动...
class VedioThread(QThread): sinout = pyqtSignal(int) def __init__(self): super(VedioThread, self).__init__() def run(self): # 需要执行的内容 show_print() # 发出信号 self.sinout.emit(1) if __name__ == "__main__": app = QApplication(sys.argv) window = VedioGui() window...