欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

pyqt4教程之messagebox使用示例分享

 更新時(shí)間:2014年03月07日 10:33:18   作者:  
這篇文章主要介紹了pyqt4的messagebox使用示例,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

#coding=utf-8
#對(duì)話框
import sys
from PyQt4 import QtGui, QtCore
class Window( QtGui.QWidget ):
    def __init__( self ):
        super( Window, self ).__init__()
        self.setWindowTitle( "hello" )
        self.resize( 500, 500 )

        gridlayout = QtGui.QGridLayout()

        self.AboutButton = QtGui.QPushButton( "About" )
        gridlayout.addWidget( self.AboutButton, 0, 0 )
        self.AboutQtButton = QtGui.QPushButton( "AboutQt" )
        gridlayout.addWidget( self.AboutQtButton, 0, 1 )
        self.CriticalButton = QtGui.QPushButton( "CriticalButton" )
        gridlayout.addWidget( self.CriticalButton, 1, 0 )
        self.InfoButton = QtGui.QPushButton( "Info" )
        gridlayout.addWidget( self.InfoButton, 1, 1 )
        self.QuestionButton = QtGui.QPushButton( "Question" )
        gridlayout.addWidget( self.QuestionButton, 2, 0 )
        self.WarningButton = QtGui.QPushButton( "Warning" )
        gridlayout.addWidget( self.WarningButton, 2, 1 )

        spacer = QtGui.QSpacerItem( 200, 80 )
        gridlayout.addItem( spacer, 3, 1, 1, 5 )
        self.setLayout( gridlayout )

        self.connect( self.AboutButton, QtCore.SIGNAL( 'clicked()' ), self.OnAboutButton )
        self.connect( self.AboutQtButton, QtCore.SIGNAL( 'clicked()' ), self.OnAboutQtButton )
        self.connect( self.CriticalButton, QtCore.SIGNAL( 'clicked()' ), self.OnCriticalButton )
        self.connect( self.InfoButton, QtCore.SIGNAL( 'clicked()' ), self.OnInfoButton )
        self.connect( self.QuestionButton, QtCore.SIGNAL( 'clicked()' ), self.OnQuestionButton )
        self.connect( self.WarningButton, QtCore.SIGNAL( 'clicked()' ), self.OnWarningButton )

    def OnAboutButton( self ):
        QtGui.QMessageBox.about( self, 'PyQt', "About" )

    def OnAboutQtButton( self ):
        QtGui.QMessageBox.aboutQt( self, "PyQt" )

    def OnCriticalButton( self ):
        r = QtGui.QMessageBox.critical( self, "PyQT", "CriticalButton", QtGui.QMessageBox.Abort,
                                   QtGui.QMessageBox.Retry, QtGui.QMessageBox.Ignore )
        if r == QtGui.QMessageBox.Abort:
            self.setWindowTitle( "Abort" )
        elif r == QtGui.QMessageBox.Retry:
            self.setWindowTitle( "Retry" )
        elif r == QtGui.QMessageBox.Ignore:
            self.setWindowTitle( "Ignore" )
        else:
            pass

    def OnInfoButton( self ):
        QtGui.QMessageBox.information( self, "Pyqt", "information" )

    def OnQuestionButton( self ):
        r = QtGui.QMessageBox.question( self, "PyQt", "Question", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No, QtGui.QMessageBox.Cancel )

    def OnWarningButton( self ):
        r = QtGui.QMessageBox.warning( self, "PyQT", "warning", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No )

        
app = QtGui.QApplication( sys.argv )
win = Window()
win.show()
app.exec_()

相關(guān)文章

  • python自動(dòng)循環(huán)定時(shí)開關(guān)機(jī)(非重啟)測試

    python自動(dòng)循環(huán)定時(shí)開關(guān)機(jī)(非重啟)測試

    這篇文章主要為大家詳細(xì)介紹了python自動(dòng)循環(huán)定時(shí)開關(guān)機(jī)(非重啟)測試,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-08-08
  • numpy的sum函數(shù)的axis和keepdim參數(shù)詳解

    numpy的sum函數(shù)的axis和keepdim參數(shù)詳解

    這篇文章主要介紹了numpy的sum函數(shù)的axis和keepdim參數(shù)詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • Django request.META.get()獲取不到header頭的原因分析

    Django request.META.get()獲取不到header頭的原因分析

    這篇文章主要介紹了Django request.META.get()獲取不到header頭的原因分析,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • Python?matplotlib實(shí)現(xiàn)多子圖布局

    Python?matplotlib實(shí)現(xiàn)多子圖布局

    多子圖布局是指在一個(gè)圖像中同時(shí)顯示多個(gè)子圖,每個(gè)子圖可以是獨(dú)立的圖形或者是相互關(guān)聯(lián)的圖形,下面我們就來了解下matplotlib是如何實(shí)現(xiàn)多子圖布局的吧
    2023-12-12
  • Python中yield關(guān)鍵字及與return的區(qū)別詳解

    Python中yield關(guān)鍵字及與return的區(qū)別詳解

    這篇文章主要介紹了Python中yield關(guān)鍵字及與return的區(qū)別詳解,帶有 yield 的函數(shù)在 Python 中被稱之為 generator生成器,比如列表所有數(shù)據(jù)都在內(nèi)存中,如果有海量數(shù)據(jù)的話將會(huì)非常耗內(nèi)存,想要得到龐大的數(shù)據(jù),又想讓它占用空間少,那就用生成器,需要的朋友可以參考下
    2023-08-08
  • python讀取并定位excel數(shù)據(jù)坐標(biāo)系詳解

    python讀取并定位excel數(shù)據(jù)坐標(biāo)系詳解

    這篇文章主要介紹了python讀取并定位excel數(shù)據(jù)坐標(biāo)系詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-06-06
  • 通過cmd進(jìn)入python的步驟

    通過cmd進(jìn)入python的步驟

    在本篇文章里小編給大家整理了關(guān)于通過cmd進(jìn)入python的步驟和實(shí)例,需要的朋友們可以參考下。
    2020-06-06
  • elasticsearch python 查詢的兩種方法

    elasticsearch python 查詢的兩種方法

    這篇文章主要介紹了elasticsearch python 查詢的兩種方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-08-08
  • python django生成遷移文件的實(shí)例

    python django生成遷移文件的實(shí)例

    今天小編就為大家分享一篇python django生成遷移文件的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-08-08
  • Python 異步之推導(dǎo)式示例詳解

    Python 異步之推導(dǎo)式示例詳解

    這篇文章主要為大家介紹了Python 異步之推導(dǎo)式示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03

最新評(píng)論