
python
chen__cheng
1.1的n次方
展开
-
python3多线程更新pyqt5 UI
思路:主线程创建UI,将主线程的UI槽函数传给子线程,当子线程工作完成之后,发出信号,通知主线程的UI槽函数 代码: import sys from PyQt5.QtCore import * from PyQt5.QtWidgets import * import time # 为窗口类添加信号 class BackendThread(QThread): update_date = pyqtSignal(str) def run(self): while True:原创 2021-07-03 18:56:44 · 696 阅读 · 0 评论 -
python PyQt5 多线程报错 QObject: Cannot create children for a parent that is in a different thread.
出错详情: QObject: Cannot create children for a parent that is in a different thread. (Parent is QNetworkAccessManager(0x2db2d8f1880), parent’s thread is QThread(0x2db2cb760a0), current thread is QThread(0x2db2da2a4e0) 原因:主线程UI界面的成员传入到了非主线程中,这导致了跨线程。 python3原创 2021-07-03 18:51:27 · 1325 阅读 · 2 评论