dialog

Functions:

pop_dialog(message[, details, buttons, ...])

Convenience function to pop a :class:`.QtGui.QDialog window to display a message.

pop_dialog(message: str, details: str = '', buttons: tuple = ('Ok',), modality: str = 'nonmodal', msg_type: str = 'info') PySide2.QtWidgets.QMessageBox[source]

Convenience function to pop a :class:`.QtGui.QDialog window to display a message.

Note

This function does not call .exec_ on the dialog so that it can be managed by the caller.

Examples

box = pop_dialog(

message=’Hey what up’, details=’i got something to tell you’, buttons = (‘Ok’, ‘Cancel’))

ret = box.exec_() if ret == box.Ok:

print(“user answered ‘Ok’”)

else:

print(“user answered ‘Cancel’”)

Parameters
  • message (str) – message to be displayed

  • details (str) – Additional detailed to be added to the displayed message

  • buttons (list) – A list specifying which QtWidgets.QMessageBox.StandardButton s to display. Use a string matching the button name, eg. “Ok” gives QtWidgets.QMessageBox.Ok

    The full list of available buttons is:

    ['NoButton', 'Ok', 'Save', 'SaveAll', 'Open', 'Yes', 'YesToAll',
     'No', 'NoToAll', 'Abort', 'Retry', 'Ignore', 'Close', 'Cancel',
     'Discard', 'Help', 'Apply', 'Reset', 'RestoreDefaults',
     'FirstButton', 'LastButton', 'YesAll', 'NoAll', 'Default',
     'Escape', 'FlagMask', 'ButtonMask']
    
  • modality (str) – Window modality to use, one of “modal”, “nonmodal” (default). Modal windows block nonmodal windows don’t.

  • msg_type (str) – “info” (default), “question”, “warning”, or “error” to use QtGui.QMessageBox.information(), QtGui.QMessageBox.question(), QtGui.QMessageBox.warning(), or QtGui.QMessageBox.error(), respectively

Returns

QtWidgets.QMessageBox