class RunObject(QObject):
"""待放入进程的对象"""
@Slot()
def run(self):
"""在子进程中按顺序运行模块对应的类"""
self.func()
# 程序运行结束信号
self.complete.emit()
thread = QThread()
thread.start()
object = RunObject()
object.moveToThread(thread)
run_thread.started.connect(run_object.run)
# thread.quit()
# thread.wait()
因为RunObject的run方法虽然运行结束,但thread还在运行导致和主进程冲突所以主窗口Crash
解决方法:thread内的程序运行后立刻结束thread,即使用注释掉的两行



