################################ # PyQt5中文网 - PyQt5全套视频教程 # # https://www.PyQt5.cn/ # # 主讲: 村长 # ################################ from PyQt5.Qt import * class MySignal1(QObject): sendmsg = pyqtSignal([str], [str, int]) def send_msg(self): self.sendmsg[str, int].emit('hello', 2) self.sendmsg[str].emit('hello') class Myslot1(QObject): def get_msg(self, str, a): print('你好' + str) print(a) mysignal1 = MySignal1() myslot1 = Myslot1() mysignal1.sendmsg[str, int].connect(myslot1.get_msg) # mysignal1.sendmsg[str].connect(myslot1.get_msg) mysignal1.send_msg()
本文摘自 :https://www.cnblogs.com/