美文网首页
PyQt5消息框QMessageBox

PyQt5消息框QMessageBox

作者: 老王和坑坑 | 来源:发表于2018-10-15 22:10 被阅读0次

    QMessageBox在PyQt5.QtWidgets下,要先导入

    from PyQt5 import QtWidgets
    

    通用参数说明

    QMessageBox下的消息框一般传参如下

    • 第一个参数QWidget为父窗口
    • 第二个参数为消息框的窗口标题
    • 第三个参数是按钮,多个按钮用|分开例如
    msg_box = QtWidgets.QMessageBox
    msg_box.question(self, '窗口标题', '提示信息', msg_box.Ok | msg_box.Cancel | msg_box.Yes, msg_box.Cancel)
    
    • 第四个参数为默认高亮的按钮

    QMessageBox内置的常用按钮

    • QMessageBox.Ok
    • QMessageBox.No
    • QMessageBox.Cancel
    • QMessageBox.Yes
    • QMessageBox.Close
    • QMessageBox.Discard

    信息框QMessageBox.information

    def information(self, QWidget, p_str, p_str_1, buttons, QMessageBox_StandardButtons=None, QMessageBox_StandardButton=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
            """ information(QWidget, str, str, buttons: Union[QMessageBox.StandardButtons, QMessageBox.StandardButton] = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) -> QMessageBox.StandardButton """
            pass
    

    问答框 QMessageBox.question

    def question(self, QWidget, p_str, p_str_1, buttons, QMessageBox_StandardButtons=None, QMessageBox_StandardButton=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
            """ question(QWidget, str, str, buttons: Union[QMessageBox.StandardButtons, QMessageBox.StandardButton] = QMessageBox.StandardButtons(QMessageBox.Yes|QMessageBox.No), defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) -> QMessageBox.StandardButton """
            pass
    

    警告QMessageBox.warning

    def warning(self, QWidget, p_str, p_str_1, buttons, QMessageBox_StandardButtons=None, QMessageBox_StandardButton=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
            """ warning(QWidget, str, str, buttons: Union[QMessageBox.StandardButtons, QMessageBox.StandardButton] = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) -> QMessageBox.StandardButton """
            pass
    

    危险QMessageBox.critical

    def critical(self, QWidget, p_str, p_str_1, buttons, QMessageBox_StandardButtons=None, QMessageBox_StandardButton=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
            """ critical(QWidget, str, str, buttons: Union[QMessageBox.StandardButtons, QMessageBox.StandardButton] = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) -> QMessageBox.StandardButton """
            pass
    

    关于QMessageBox.about

    def about(self, QWidget, p_str, p_str_1): # real signature unknown; restored from __doc__
            """ about(QWidget, str, str) """
            pass
    
    image

    相关文章

      网友评论

          本文标题:PyQt5消息框QMessageBox

          本文链接:https://www.haomeiwen.com/subject/urwqzftx.html