Skip to content

incendium.vision.gui.confirm

César Román edited this page Apr 30, 2024 · 9 revisions

Description

Display a confirmation dialog box to the user.

This will present the user with "Yes", "No" and "Cancel" options, and a custom message.

Syntax

incendium.vision.gui.confirm(message, [title], [show_cancel])

Args:

  • message (str): The message to display. This will be translated to the selected Locale.
  • title (str): A title for the message box. This will be translated to the selected Locale. Optional. Defaults to "Confirm".
  • show_cancel (bool): Show a cancel button in the dialog. Optional. Defaults to False.

Returns:

  • bool: True if the user selected "Yes", False if the user selected "No", None if the user selected "Cancel".

Code Examples

from __future__ import print_function

from incendium.vision import gui

message = "Would you like to continue without saving your changes?"

if gui.confirm(message, show_cancel=True):
    # TODO: Handle the response.
    print(1)
Clone this wiki locally