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:
A
GtkAlertDialog
object collects the arguments that are needed to present a message to the user.The message is shown with the [method`Gtk`.AlertDialog.choose] function. This API follows the GIO async pattern, and the result can be obtained by calling [method`Gtk`.AlertDialog.choose_finish].
If you don’t need to wait for a button to be clicked, you can use [method`Gtk`.AlertDialog.show].
New in version 4.10.
- choose(parent, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
cancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
This function shows the alert to the user.
The callback will be called when the alert is dismissed. It should call [method`Gtk`.AlertDialog.choose_finish] to obtain the result.
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 is [method`Gtk`.AlertDialog.show].New in version 4.10.
- choose_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- 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 and returns the index of the button that was clicked.
New 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.
New 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.
New in version 4.10.
- get_detail()[source]¶
- Returns:
the detail text
- Return type:
Returns the detail text that will be shown in the alert.
New in version 4.10.
- get_message()[source]¶
- Returns:
the message
- Return type:
Returns the message that will be shown in the alert.
New 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.
New in version 4.10.
- set_buttons(labels)[source]¶
- Parameters:
labels ([
str
]) – the new button labels
Sets the button labels for the alert.
New 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.
New 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.
New 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.
New in version 4.10.
- set_message(message)[source]¶
- Parameters:
message (
str
) – the new message
Sets the message that will be shown in the alert.
New 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.
New in version 4.10.
- show(parent)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
Show the alert to the user.
This function is a simple 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
Gio.Cancellable
or callback respectively.New 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 _ to indicate the mnemonic character.
If this property is not set, then a ‘Close’ button is automatically created.
New in version 4.10.
- Gtk.AlertDialog.props.cancel_button¶
- Name:
cancel-button
- Type:
- Default Value:
-1
- Flags:
This property determines what happens when the Escape 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
buttons
array, then an error is returned.If
buttons
isNULL
, then the automatically created ‘Close’ button is treated as both cancel and default button, so 0 is returned.New in version 4.10.
- Gtk.AlertDialog.props.default_button¶
- Name:
default-button
- Type:
- Default Value:
-1
- Flags:
This property determines what happens when the Return 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
buttons
array, then nothing happens.If
buttons
isNULL
, then the automatically created ‘Close’ button is treated as both cancel and default button, so 0 is returned.New in version 4.10.
- Gtk.AlertDialog.props.detail¶
- Name:
detail
- Type:
- Default Value:
- Flags:
The detail text for the alert.
New in version 4.10.
- Gtk.AlertDialog.props.message¶
- Name:
message
- Type:
- Default Value:
- Flags:
The message for the alert.
New in version 4.10.