class Dialog(Window)


The Dialog class is a subclass of Window designed for use as a dialog box. It provides facilities for defining default and cancel buttons that are activated by keyboard equivalents.

A Dialog differs from a Window in having a default style of 'nonmodal_dialog', and by default (if possible on the platform) not being closable, zoomable or resizable. These options can be overridden in the constructor call.

On platforms which display a menu bar at the top of each window, a Dialog does not normally have a menu bar. Enabled menu items are still available by their keyboard equivalents while the Dialog is active, however.

Constructor

Dialog(style = 'nonmodal_dialog',
       closable = False, resizable = False, zoomable = False,
       movable = platform_default, hidable = platform_default)
Constructs a Dialog with the specified options. The default values for the movable and hidable options are platform-dependent.

Properties

default_button
The Button that is to be activated in response to the platform's keyboard equivalent for the default button of a dialog. Setting this property also causes the button's default property to be set to true, so that the button will be displayed as a default button, and sets the button's action property to 'do_default_action'.

cancel_button
The Button that is to be activated in response to the platform's keyboard equivalent for the cancel button of a dialog. Setting this property also causes the button's cancel property to be set to true, so that the button will be displayed as a cancel button, and sets the button's action property to 'do_cancel_action'.

Action Properties

default_action
Action to perform in response to a Return or Enter key event. This action is also typically invoked by activating a default button or pressing Return or Enter in a text field. The default is 'ok', which is implemented by ModalDialog to dismiss the dialog with the value True. You can create a button which invokes this action using DefaultButton.
cancel_action
Action to perform in response to an Escape key event. This action is also typically invoked by activating a cancel button or pressing Escape in a text field. The default is 'cancel', which is implemented by ModalDialog to dismiss the dialog with the value False. You can create a button which invokes this action using CancelButton.