python pip install PyQt5 python from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton from PyQt5.QtCore import Qt app = QApplication([]) window = QWidget() window.setWindowTitle('PyQt Example') window.setGeometry(100, 100, 300, 200) label = QLabel('Hello PyQt!', window) label.setAlignment(Qt.AlignCenter) button = QPushButton('Change Text', window) button.setGeometry(100, 100, 100, 30) def change_text(): label.setText('Text Changed!') button.clicked.connect(change_text) window.show() app.exec_()


上一篇:
下一篇:
切换中文