from PyQt5 import QtWidgets,QtCore
import sys,time
from myDesigner1 import Ui_Form
class mySignalSlot(QtWidgets.QWidget,Ui_Form):
_signal = QtCore.pyqtSignal()
def __init__(self):
super(mySignalSlot,self).__init__()
self.setupUi(self)
self.pushButton.clicked.connect(self.prn1)
self.pushButton_2.clicked.connect(self.prn2)
self._signal.connect(self.mysignalslot)
def prn1(self):
print("Button1_test1")
time.sleep(1)
print('延时1秒')
self._signal.emit()
def prn2(self):
print("Button2_test2")
time.sleep(1)
print('延时2秒')
self._signal.emit()
def mysignalslot(self):
print('这是槽')
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
myshow = mySignalSlot()
myshow.show()
sys.exit(app.exec_())