pyface.i_dialog module¶
The abstract interface for all pyface dialogs.
- class pyface.i_dialog.IDialog(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]¶
Bases:
IWindow
The abstract interface for all pyface dialogs.
Usage: Sub-class this class and either override ‘_create_contents’ or more simply, just override the two methods that do the real work:-
‘_create_dialog_area’ creates the main content of the dialog.
‘_create_buttons’ creates the dialog buttons.
- cancel_label = Str()¶
The label for the ‘cancel’ button. The default is toolkit specific.
- help_id = Str()¶
The context sensitive help Id (the ‘Help’ button is only shown iff this is set).
- help_label = Str()¶
The label for the ‘help’ button. The default is toolkit specific.
- ok_label = Str()¶
The label for the ‘ok’ button. The default is toolkit specific.
- resizeable = Bool(True)¶
Is the dialog resizeable?
- return_code = Int(OK)¶
The return code after the window is closed to indicate whether the dialog was closed via ‘Ok’ or ‘Cancel’).
- open()[source]¶
Opens the dialog.
If the dialog is modal then the dialog’s event loop is entered and the dialog closed afterwards. The ‘return_code’ trait is updated according to the button the user pressed and this value is also returned.
If the dialog is non-modal the return_code trait is set to ‘OK’.
- Returns
return_code – The value of the
return_code
trait.- Return type
OK or CANCEL
- class pyface.i_dialog.MDialog[source]¶
Bases:
HasTraits
The mixin class that contains common code for toolkit specific implementations of the IDialog interface.
Implements: open() Reimplements: _add_event_listeners(), create()
- open()[source]¶
Opens the dialog.
If the dialog is modal then the dialog’s event loop is entered and the dialog closed afterwards. The ‘return_code’ trait is updated according to the button the user pressed and this value is also returned.
If the dialog is non-modal the return_code trait is set to ‘OK’.
- Returns
return_code – The value of the
return_code
trait.- Return type
OK or CANCEL