enaml.widgets.toolkit_dialog

Classes

ToolkitDialog

A base class for defining toolkit dialogs.

class enaml.widgets.toolkit_dialog.ToolkitDialog(parent=None, **kwargs)[source]

Bases: ToolkitObject

A base class for defining toolkit dialogs.

A toolkit dialog is a dialog where the content is defined by the toolkit rather than the user. Customary examples would be a file dialog or a color selection dialog, where the implementation can often be a native operating system dialog.

title

The title of the dialog window.

callback

An optional callback which will be invoked when the dialog is closed. This is a convenience to make it easier to handle a dialog opened in non-blocking mode. The callback must accept a single argument, which will be the dialog instance.

destroy_on_close

Whether to destroy the dialog widget on close. The default is True since dialogs are typically used in a transitory fashion.

accepted

An event fired if the dialog is accepted. It has no payload.

rejected

An event fired when the dialog is rejected. It has no payload.

finished

An event fired when the dialog is finished. The payload is the boolean result of the dialog.

result

Whether or not the dialog was accepted by the user. It will be updated when the dialog is closed. This value is output only.

proxy

A reference to the ProxyToolkitDialog object.

show()[source]

Open the dialog as a non modal dialog.

open()[source]

Open the dialog as a window modal dialog.

exec_()[source]

Open the dialog as an application modal dialog.

Returns:

result – Whether or not the dialog was accepted.

Return type:

bool

accept()[source]

Accept the current state and close the dialog.

reject()[source]

Reject the current state and close the dialog.