pyqt5一个信号连接多个槽函数

import sys
from PyQt5.QtWidgets import QApplication, QWidget,QLabel,QPushButton,QVBoxLayout


class Demo(QWidget):
    def __init__(self):
        super(Demo, self).__init__()
        self.label = QLabel('Start', self)
        self.btn = QPushButton("Button",self)
        self.btn.clicked.connect(self.change_text)
        self.btn.clicked.connect(self.change_size)

        self.v_layout = QVBoxLayout()
        self.v_layout.addWidget(self.label)
        self.v_layout.addWidget(self.btn)
        self.setLayout(self.v_layout)

    def change_text(self):

        self.label.setText('Button')
        print(666)

    def change_size(self):
        self.resize(600,600)#将窗口设置成600*600



if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = Demo()
    demo.show()
    sys.exit(app.exec_())

 

上一篇:poj 1466 Girls and Boys 二分图 最大独立集 (★★☆☆☆)


下一篇:简易的不科学立直麻将学习笔记(2)-防守策略-弃胡编