a p2p demo, computer network project. based on Python3
项目主页:
http://wangyf.top/p/pre/p2p-demo
QT运行时会阻塞进程。
需要分离UI线程和任务线程
$ python src/UI.py
or exlicitely
$ python3 src/UI.py
define a class and inherit from QThread
from QtPy5.QtCore import QThread
class Task(QThread):
pipe = pyqtSignal(str)
def __init__():
pass
then define function run
class Task(QThread):
...
def run(self, *arg):
do-your-task()
self.pipe.emit("hello world")
what you send in self.pipe.emit()
would be sent to UI and shown properly.