Hello PyQt
試驗 PyQt
此 Hello World 程式是參考這篇文章:
Getting Started with PyQt4 at boddie.org.uk
# -*- coding: utf-8 -*- """ not my code:-) Only test hello world , it copy from: http://www.boddie.org.uk/david/Projects/Python/Qt/Getting_Started_With_PyQt4_v1.pdf """ import sys from PyQt4.QtGui import QApplication,QPushButton app=QApplication(sys.argv) # 來顆按鈕 button=QPushButton("Hello World") button.show() sys.exit(app.exec_())
以 Spyder 直接執行 ,得結果!
一個按鈕的小視窗,按鈕字樣是 Hello World。
由於沒有定義任何外觀跟尺寸,這個按鈕理所當然的跟視窗一樣大…
Leave a Reply