# -*- coding:utf-8 -*-
import sys
import time
from PyQt5.QtWidgets import QApplication,QWidget,QLabel,QPushButton,QVBoxLayout,QHBoxLayout,QComboBox,QRadioButton,QLineEdit
from PyQt5.QtGui import QMovie,QPixmap
from PyQt5.QtCore import Qt,QBuffer,QByteArray,QIODevice,pyqtSignal,QThread,QEventLoop,QSize,QTimer
class win(QWidget):
def __init__(self,parent=None):
super(win,self).__init__(parent)
self.resize(500,500)
self.child = t()
self.child.hello.connect(self.hi)
self.child.start()
def hi(self,msg):
print(111)
class t(QThread):
hello = pyqtSignal(str)
def __init__(self,parent=None):
super(t,self).__init__(parent)
def __del__(self):
self.wait()
def run(self):
app.processEvents()
self.loop = QEventLoop()
self.lbl = QLabel()
self.lbl.resize(300,300)
self.lbl.show()
self.t1 = t1()
self.t1.hell.connect(self.qu)
self.t1.start()
self.loop.exec_()
def qu(self,msg):
if msg:
self.lbl.quit()
self.loop.quit()
class t1(QThread):
hell = pyqtSignal(str)
def __init__(self,parent=None):
super(t1,self).__init__(parent)
def run(self):
time.sleep(20)
self.hell.emit("111")
if __name__=="__main__":
app = QApplication(sys.argv)
win=win()
win.show()
sys.exit(app.exec_())
是QEventLoop用错了吗???