traitsui.ui module¶
Defines the UI class used to represent an active traits-based user interface.
- class traitsui.ui.UI[source]¶
Bases:
HasPrivateTraits
Information about the user interface for a View.
- add_checked(checked_when, editor)[source]¶
Adds a conditionally enabled (menu) Editor object to the list of monitored ‘checked_when’ objects.
- add_defined(method)[source]¶
Adds a Handler method to the list of methods to be called once the user interface has been constructed.
- add_enabled(enabled_when, editor)[source]¶
Adds a conditionally enabled Editor object to the list of monitored ‘enabled_when’ objects.
- add_visible(visible_when, editor)[source]¶
Adds a conditionally enabled Editor object to the list of monitored ‘visible_when’ objects.
- context = Dict(Str, Any)¶
Context objects that the UI is editing
- control = Any()¶
Panel or dialog associated with the user interface
- destroyed = Bool(False)¶
Set to True when the UI has finished being destroyed.
- disposable_traits = ['view_elements', 'info', 'handler', 'context', 'view', 'history', 'key_bindings', 'icon', 'rebuild']¶
List of additional traits that are discarded when a user interface is disposed.
- errors = Int()¶
The number of currently pending editor error conditions
- eval_when(when, result=True)[source]¶
Evaluates an expression in the UI’s context and returns the result.
- find(include)[source]¶
Finds the definition of the specified Include object in the current user interface building context.
- get_error_controls()[source]¶
Returns the list of editor error controls contained by the user interface.
- handler = Instance(Handler)¶
Handler object used for event handling
- history = Any()¶
Undo and Redo history
- icon = Image¶
The ImageResource of the icon, if any
- id = Str()¶
The unique ID for this UI for persistence
- info = Instance(UIInfo)¶
UIInfo object containing context or editor objects
- key_bindings = Property(depends_on=["view._key_bindings", "context"])¶
The KeyBindings object (if any) for this UI:
- modified = Bool(False)¶
Have any modifications been made to UI contents?
- owner = Any()¶
Toolkit-specific object that “owns” control
- parent = Instance("UI")¶
The parent UI (if any) of this UI
- rebuild = Callable()¶
The code used to rebuild an updated user interface
- recyclable_traits = ['_context', '_revert', '_defined', '_visible', '_enabled', '_checked', '_search', '_dispatchers', '_editors', '_names', '_active_group', '_undoable', '_rebuild', '_groups_cache', '_key_bindings', '_focus_control']¶
List of traits that are reset when a user interface is recycled (i.e. rebuilt).
- restore_prefs()[source]¶
Retrieves and restores any saved user preference information associated with the UI.
- result = Bool(False)¶
Result from a modal or wizard dialog:
- scrollable = Bool(False)¶
Should the created UI have scroll bars?
- title = Str()¶
Title of the dialog, if any
- updated = Event(Bool)¶
Event when the user interface has changed
- view = Instance("traitsui.view.View")¶
View template used to construct the user interface
- view_elements = Instance(ViewElements)¶
The ViewElements object from which this UI resolves Include items