AlertDialog#
Added in version 4.10.
Superclasses: Object
A GtkAlertDialog
object collects the arguments that
are needed to present a message to the user.
The message is shown with the choose
function.
If you don’t need to wait for a button to be clicked, you can use
show
.
Methods#
- class AlertDialog
- choose(parent: Window | None = None, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None #
This function shows the alert to the user.
It is ok to pass
NULL
for the callback if the alert does not have more than one button. A simpler API for this case isshow
.Added in version 4.10.
- Parameters:
parent – the parent
GtkWindow
cancellable – a
GCancellable
to cancel the operationcallback – a callback to call when the operation is complete
user_data – data to pass to
callback
- choose_finish(result: AsyncResult) int #
Finishes the
choose
call and returns the index of the button that was clicked.Added in version 4.10.
- Parameters:
result – a
GAsyncResult
- get_modal() bool #
Returns whether the alert blocks interaction with the parent window while it is presented.
Added in version 4.10.
- set_buttons(labels: Sequence[str]) None #
Sets the button labels for the alert.
Added in version 4.10.
- Parameters:
labels – the new button labels
- set_cancel_button(button: int) None #
Sets the index of the cancel button.
See
cancel_button
for details of how this value is used.Added in version 4.10.
- Parameters:
button – the new cancel button
- set_default_button(button: int) None #
Sets the index of the default button.
See
default_button
for details of how this value is used.Added in version 4.10.
- Parameters:
button – the new default button
- set_detail(detail: str) None #
Sets the detail text that will be shown in the alert.
Added in version 4.10.
- Parameters:
detail – the new detail text
- set_message(message: str) None #
Sets the message that will be shown in the alert.
Added in version 4.10.
- Parameters:
message – the new message
- set_modal(modal: bool) None #
Sets whether the alert blocks interaction with the parent window while it is presented.
Added in version 4.10.
- Parameters:
modal – the new value
- show(parent: Window | None = None) None #
Show the alert to the user.
This function is a simple version of
choose
intended for dialogs with a single button. If you want to cancel the dialog or if the alert has more than one button, you should use that function instead and provide it with aCancellable
or callback respectively.Added in version 4.10.
- Parameters:
parent – the parent
GtkWindow
Properties#
- class AlertDialog