ScriptDialog

class ScriptDialog(*args, **kwargs)

Carries details to be shown in user-facing dialogs.

Methods

class ScriptDialog
close() None

Close dialog.

When handling a ScriptDialog asynchronously (ref() was called in WebView::script-dialog callback), this function needs to be called to notify that we are done with the script dialog. The dialog will be closed on destruction if this function hasn’t been called before.

Added in version 2.24.

confirm_set_confirmed(confirmed: bool) None

Set whether the user confirmed the dialog.

This method is used for CONFIRM and BEFORE_UNLOAD_CONFIRM dialogs when WebView::script-dialog signal is emitted to set whether the user confirmed the dialog or not. The default implementation of WebView::script-dialog signal sets True when the OK or Stay buttons are clicked and False otherwise. It’s an error to use this method with a ScriptDialog that is not of type CONFIRM or BEFORE_UNLOAD_CONFIRM

Parameters:

confirmed – whether user confirmed the dialog

get_dialog_type() ScriptDialogType

Get the dialog type of a ScriptDialog.

get_message() str

Get the message of a ScriptDialog.

prompt_get_default_text() str

Get the default text of a ScriptDialog of type PROMPT.

It’s an error to use this method with a ScriptDialog that is not of type PROMPT.

prompt_set_text(text: str) None

Set the text entered by the user in the dialog.

This method is used for PROMPT dialogs when WebView::script-dialog signal is emitted to set the text entered by the user. The default implementation of WebView::script-dialog signal sets the text of the entry form when OK button is clicked, otherwise None is set. It’s an error to use this method with a ScriptDialog that is not of type PROMPT.

Parameters:

text – the text to set