Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 737 Bytes

README.md

File metadata and controls

41 lines (34 loc) · 737 Bytes

p2p-demo

a p2p demo, computer network project. based on Python3

项目主页:

http://wangyf.top/p/pre/p2p-demo

瓶颈

QT运行时会阻塞进程。
需要分离UI线程和任务线程

Usage

$ python src/UI.py

or exlicitely

$ python3 src/UI.py

backend

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.