Home >Backend Development >PHP Tutorial >python3.2 + PyQt4 interface development hello world_PHP tutorial

python3.2 + PyQt4 interface development hello world_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:35:22810browse

You need to install python3.2 first and then install the PyQt4 interface library version corresponding to python3.2

<span import</span><span  sys
</span><span from</span> PyQt4 <span import</span><span  QtGui , QtCore

app </span>=<span  QtGui.QApplication( sys.argv )

widget </span>=<span  QtGui.QWidget()
widget.resize( </span>250 , 150<span  )
widget.setWindowTitle( </span><span '</span><span 窗口标题</span><span '</span><span  )

</span><span #</span><span  设置图标</span>
widget.setWindowIcon( QtGui.QIcon( <span '</span><span 16-111129230521</span><span '</span><span  ) )

</span><span #</span><span  设置窗口中间部分的文字tip提示</span>
widget.setToolTip( <span '</span><span <b>文字提示:::</b></span><span '</span><span  )
QtGui.QToolTip.setFont( QtGui.QFont( </span><span '</span><span OldEnglish</span><span '</span> , 12<span  ) )

</span><span #</span><span  退出按钮</span>
quit = QtGui.QPushButton( <span '</span><span 退出</span><span '</span><span  , widget )
quit.setGeometry( </span>10 ,20 , 50 ,30<span  )

</span><span #</span><span  退出按钮 连接 到py的信号槽机制</span>
widget.connect( quit , QtCore.SIGNAL( <span '</span><span clicked()</span><span '</span> ) , QtGui.qApp , QtCore.SLOT( <span '</span><span quit()</span><span '</span><span  )  )

reply </span>= QtGui.QMessageBox.question( widget , <span '</span><span message</span><span '</span> , <span '</span><span 问题?</span><span '</span><span  , QtGui.QMessageBox.Yes , QtGui.QMessageBox.No )

</span><span #</span><span  显示窗体部件</span>
<span widget.show()

sys.exit( app.exec_() )</span>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/744169.htmlTechArticleYou need to install python3.2 first and then install the PyQt4 interface library version corresponding to python3.2 PyQt4 == 250, 150 widget .setWindowIcon( QtGui.QIcon( widget.setToolTip( , 12 quit = QtGui.QPushButton(...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn