认识PyQt5-HelloWorld

from PyQt5.Qt import *
import sys

class Window(QWidget):
    def __init__(self, title):
        self.title = title
        super().__init__()
        self.initUI()
        self.setGeometry(300, 200, 300, 200)
        self.setWindowTitle(self.title)
        self.show()

    def initUI(self):
        btn = QPushButton()
        btn.setParent(self)
        btn.setText("我是按钮")
        btn.clicked.connect(self.helloWolrd)

    def helloWolrd(self):
        print("这是我的第一个PyQt程序")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Window("I AM AESCR")
    sys.exit(app.exec_())

本文标题:认识PyQt5-HelloWorld
URL网址:http://www.xwwzsj.com/article/gseiph.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款