pyside2多线程运行
from PySide2.QtUiTools import QUiLoader
import PySide2.QtWidgets as psw
from PySide2.QtCore import Signal,QObject
from threading import Thread
class MySignals(QObject):
text_print=Signal(psw.QTextBrowser,str)
updata_table=Signal(str)
global_ms=MySignals()
class Status:
def handleButton(self):
print(psw.QButtonGroup.checkedButton())
def __init__(self):
self.ui=QUiLoader().load('ui/main.ui')
global_ms.text_print.connect(self.printShowInfor)
self.showInfor=self.ui.textEdit
self.ui.pushButton.clicked.connect(self.task1)
def printShowInfor(self,text_object,infor):
text_object.setText(infor)
def task1(self):
def thread_send():
global_ms.text_print.emit(self.showInfor,"wocwoc")
thread=Thread(target=thread_send)
thread.start()
app=psw.QApplication([])
status=Status()
status.ui.show()
app.exec_()