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("這是我的第一個(gè)PyQt程序")
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Window("I AM AESCR")
sys.exit(app.exec_())
網(wǎng)站名稱(chēng):認(rèn)識(shí)PyQt5-HelloWorld
網(wǎng)頁(yè)地址:
http://weahome.cn/article/gseiph.html