Messagebox#
Messagebox shows a modal message dialog and returns which button the user
clicked. Every method is a static method — call it on the class, no instance
needed (Messagebox.show_info("Saved.")). Each blocks until the user responds
and returns the clicked button’s text, or None if the dialog is closed.
Common parameters#
Every method takes message and title positionally, plus these
keyword-only options:
Option |
Type |
Description |
|---|---|---|
|
|
The window to center over and block while open. Defaults to the application root. |
|
|
Ring the display bell when the dialog appears. |
|
|
An |
|
|
Override the buttons — a list of labels, each optionally |
|
|
A Bootstrap Icons glyph name shown beside the message. |
|
|
Translate the standard button labels through the message catalog. Default
|
Methods#
- static show_info(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
An informational message with an info icon and an OK button.
- Returns:
the clicked button’s text, or
None.
- static show_warning(message, title=' ', *, parent=None, alert=True, position=None, buttons=None, icon=None, localize=True)
A warning message with a warning icon and an OK button. Rings the bell by default.
- Returns:
the clicked button’s text, or
None.
- static show_error(message, title=' ', *, parent=None, alert=True, position=None, buttons=None, icon=None, localize=True)
An error message with an error icon and an OK button. Rings the bell by default.
- Returns:
the clicked button’s text, or
None.
- static show_question(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with a question icon and an OK button. Pass
buttonsfor a different choice set.- Returns:
the clicked button’s text, or
None.
- static ok(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with a single OK button.
- Returns:
"OK", orNoneif closed.
- static okcancel(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with OK and Cancel buttons.
- Returns:
"OK"or"Cancel", orNoneif closed.
- static yesno(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with Yes and No buttons.
- Returns:
"Yes"or"No", orNoneif closed.
- static yesnocancel(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with Yes, No, and Cancel buttons.
- Returns:
"Yes","No", or"Cancel", orNoneif closed.
- static retrycancel(message, title=' ', *, parent=None, alert=False, position=None, buttons=None, icon=None, localize=True)
A message with Retry and Cancel buttons.
- Returns:
"Retry"or"Cancel", orNoneif closed.
See also#
Dialogs — how to use them, with examples.
Querybox — the input-and-picker facade.
MessageDialog — the dialog class
Messageboxbuilds, for full control.