Rumah >pembangunan bahagian belakang >tutorial php >python3.2 + PyQt4界面开发hello world_PHP教程

python3.2 + PyQt4界面开发hello world_PHP教程

WBOY
WBOYasal
2016-07-13 10:35:22811semak imbas

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

 

<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.htmlTechArticle需要先安装python3.2 然后安装python3.2对应的PyQt4界面库版本 PyQt4 = = 250 , 150 widget.setWindowIcon( QtGui.QIcon( widget.setToolTip( , 12 quit = QtGui.QPushButton(...
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn