Gtk.AlertDialog¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
[ |
r/w/en |
||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.AlertDialog(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Collects the arguments that are needed to present a message to the user.
The message is shown with the [method`Gtk`.AlertDialog.choose] function.
If you don’t need to wait for a button to be clicked, you can use [method`Gtk`.AlertDialog.show].
Added in version 4.10.
- choose(parent, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.WindoworNone) – the parent windowcancellable (
Gio.CancellableorNone) – a cancellable to cancel the operationcallback (
Gio.AsyncReadyCallbackorNone) – a callback to call when the operation is complete
Shows the alert to the user.
It is ok to pass
NULLfor the callback if the alert does not have more than one button. A simpler API for this case is [method`Gtk`.AlertDialog.show].Added in version 4.10.
- choose_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – the result- Raises:
- Returns:
the index of the button that was clicked, or -1 if the dialog was cancelled and [property`Gtk`.AlertDialog:cancel-button] is not set
- Return type:
Finishes the [method`Gtk`.AlertDialog.choose] call.
Added in version 4.10.
- get_cancel_button()[source]¶
- Returns:
the index of the cancel button, or -1
- Return type:
Returns the index of the cancel button.
Added in version 4.10.
- get_default_button()[source]¶
- Returns:
the index of the default button, or -1
- Return type:
Returns the index of the default button.
Added in version 4.10.
- get_detail()[source]¶
- Returns:
the detail text
- Return type:
Returns the detail text that will be shown in the alert.
Added in version 4.10.
- get_message()[source]¶
- Returns:
the message
- Return type:
Returns the message that will be shown in the alert.
Added in version 4.10.
- get_modal()[source]¶
- Returns:
true if the alert is modal
- Return type:
Returns whether the alert blocks interaction with the parent window while it is presented.
Added in version 4.10.
- set_buttons(labels)[source]¶
- Parameters:
labels ([
str]) – the new button labels
Sets the button labels for the alert.
Added in version 4.10.
- set_cancel_button(button)[source]¶
- Parameters:
button (
int) – the new cancel button
Sets the index of the cancel button.
See [property`Gtk`.AlertDialog:cancel-button] for details of how this value is used.
Added in version 4.10.
- set_default_button(button)[source]¶
- Parameters:
button (
int) – the new default button
Sets the index of the default button.
See [property`Gtk`.AlertDialog:default-button] for details of how this value is used.
Added in version 4.10.
- set_detail(detail)[source]¶
- Parameters:
detail (
str) – the new detail text
Sets the detail text that will be shown in the alert.
Added in version 4.10.
- set_message(message)[source]¶
- Parameters:
message (
str) – the new message
Sets the message that will be shown in the alert.
Added in version 4.10.
- set_modal(modal)[source]¶
- Parameters:
modal (
bool) – the new value
Sets whether the alert blocks interaction with the parent window while it is presented.
Added in version 4.10.
- show(parent)[source]¶
- Parameters:
parent (
Gtk.WindoworNone) – the parent window
Shows the alert to the user.
This function is a simpler version of [method`Gtk`.AlertDialog.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 a [class`Gio`.Cancellable] and callback respectively.
Added in version 4.10.
Property Details¶
- Gtk.AlertDialog.props.buttons¶
- Name:
buttons- Type:
[
str]- Default Value:
[]- Flags:
Labels for buttons to show in the alert.
The labels should be translated and may contain a
_character to indicate the mnemonic character.If this property is not set, then a ‘Close’ button is automatically created.
Added in version 4.10.
- Gtk.AlertDialog.props.cancel_button¶
- Name:
cancel-button- Type:
- Default Value:
-1- Flags:
Determines what happens when the <kbd>Escape</kbd> key is pressed while the alert is shown.
If this property holds the index of a button in [property`Gtk`.AlertDialog:buttons], then pressing Escape is treated as if that button was pressed. If it is -1 or not a valid index for the
buttonsarray, then an error is returned.If
buttonsisNULL, then the automatically created ‘Close’ button is treated as both cancel and default button, so 0 is returned.Added in version 4.10.
- Gtk.AlertDialog.props.default_button¶
- Name:
default-button- Type:
- Default Value:
-1- Flags:
Determines what happens when the <kbd>Return</kbd> key is pressed while the alert is shown.
If this property holds the index of a button in [property`Gtk`.AlertDialog:buttons], then pressing Return is treated as if that button was pressed. If it is -1 or not a valid index for the
buttonsarray, then nothing happens.If
buttonsisNULL, then the automatically created ‘Close’ button is treated as both cancel and default button, so 0 is returned.Added in version 4.10.
- Gtk.AlertDialog.props.detail¶
- Name:
detail- Type:
- Default Value:
- Flags:
The detail text for the alert.
Added in version 4.10.
- Gtk.AlertDialog.props.message¶
- Name:
message- Type:
- Default Value:
- Flags:
The message for the alert.
Added in version 4.10.