当前位置: 首页>>代码示例>>Python>>正文


Python QMessageBox.setStyleSheet方法代码示例

本文整理汇总了Python中python_qt_binding.QtGui.QMessageBox.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox.setStyleSheet方法的具体用法?Python QMessageBox.setStyleSheet怎么用?Python QMessageBox.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在python_qt_binding.QtGui.QMessageBox的用法示例。


在下文中一共展示了QMessageBox.setStyleSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: newButtonSetOrUpdateCurrent

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import setStyleSheet [as 别名]
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
开发者ID:ros-visualization,项目名称:speakeasy,代码行数:25,代码来源:speakeasy_ui.py

示例2: DialogService

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import setStyleSheet [as 别名]
class DialogService(object):

    class ButtonSaveResult:
        UPDATE_CURRENT = 0;
        NEW_SET = 1;
        CANCEL = 2;
        

    #----------------------------------
    # Initializer
    #--------------

    def __init__(self, parent=None):
        
        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>), 
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
	    # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler();
       	# Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags());
        self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        
        self.infoMsg = QMessageBox(parent=parent);
        self.infoMsg.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
    
    #----------------------------------
    # showErrorMsg
    #--------------
    QErrorMessage
    def showErrorMsg(self,errMsg):
        '''
        Given a string, pop up an error dialog.
        @param errMsg: The message
        @type errMsg: string
        '''
        self.errorMsgPopup.showMessage(errMsg);
    
    #----------------------------------
    # showInfoMsg 
    #--------------

    def showInfoMessage(self, text):
        self.infoMsg.setText(text);
        self.infoMsg.exec_();        

    #----------------------------------
    # newButtonSetOrUpdateCurrent
    #--------------
    
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
开发者ID:ros-visualization,项目名称:speakeasy,代码行数:77,代码来源:speakeasy_ui.py


注:本文中的python_qt_binding.QtGui.QMessageBox.setStyleSheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。