需要先安裝python3.2 然后安裝python3.2對應的PyQt4界面庫版本

import sys from PyQt4 import QtGui , QtCore app = QtGui.QApplication( sys.argv ) widget = QtGui.QWidget() widget.resize( 250 , 150 ) widget.setWindowTitle( '窗口標題' ) # 設置圖標 widget.setWindowIcon( QtGui.QIcon( '16-111129230521' ) ) # 設置窗口中間部分的文字tip提示 widget.setToolTip( '<b>文字提示:::</b>' ) QtGui.QToolTip.setFont( QtGui.QFont( 'OldEnglish' , 12 ) ) # 退出按鈕 quit = QtGui.QPushButton( '退出' , widget ) quit.setGeometry( 10 ,20 , 50 ,30 ) # 退出按鈕 連接 到py的信號槽機制 widget.connect( quit , QtCore.SIGNAL( 'clicked()' ) , QtGui.qApp , QtCore.SLOT( 'quit()' ) ) reply = QtGui.QMessageBox.question( widget , 'message' , '問題?' , QtGui.QMessageBox.Yes , QtGui.QMessageBox.No ) # 顯示窗體部件 widget.show() sys.exit( app.exec_() )
