·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> python3.2 + PyQt4界面开发hello world

python3.2 + PyQt4界面开发hello world

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23
python3.2 + PyQt4界面开发hello world

需要先安装python3.2 然后安装python3.2对应的PyQt4界面库版本

import sysfrom PyQt4 import QtGui , QtCoreapp = 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_() )