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_())