Inherits from
- ViewElement: enthought.traits.ui.view_element.ViewElement
Attributes
- apply
Should an Apply button be added? (deprecated):
apply = apply_trait
- buttons
List of button actions to add to the view. The enthought.traits.ui.menu module defines standard buttons, such as OKButton, and standard sets of buttons, such as ModalButtons, which can be used to define a value for this attribute. This value can also be a list of button name strings, such as ['OK', 'Cancel', 'Help']. If set to the empty list, the view contains a default set of buttons (equivalent to LiveButtons: Undo/Redo, Revert, OK, Cancel, Help). To suppress buttons in the view, use the NoButtons variable, defined in enthought.traits.ui.menu.
buttons = buttons_trait
- cancel
Should a Cancel button be added? (deprecated):
cancel = cancel_trait
- close_result
What result should be returned if the user clicks the window or dialog close button or icon?
close_result = close_result_trait
- content
The top-level Group object for the view:
content = content_trait
- dock
The default docking style to use for sub-groups of the view. The following values are possible:
- 'fixed': No rearrangement of sub-groups is allowed.
- 'horizontal': Moveable elements have a visual "handle" to the left by which the element can be dragged.
- 'vertical': Moveable elements have a visual "handle" above them by which the element can be dragged.
- 'tabbed': Moveable elements appear as tabbed pages, which can be arranged within the window or "stacked" so that only one appears at at a time.
dock = DockStyle
- drop_class
Class of dropped objects that can be added:
drop_class = Any
- export
The category of exported elements:
export = export_trait
- handler
The Handler object that provides GUI logic for handling events in the window. Set this attribute only if you are using a custom Handler. If not set, the default Traits UI Handler is used.
handler = handler_trait
- height
Requested height for the view window, as an (integer) number of pixels, or as a (floating point) fraction of the screen height.
height = height_trait
- help
Should a Help button be added? (deprecated):
help = help_trait
- help_id
External help context identifier, which can be used by a custom help handler. This attribute is ignored by the default help handler.
help_id = HelpId
- icon
The name of the icon to display in the dialog window title bar:
icon = Any
- id
A unique identifier for the view:
id = id_trait
- image
The image to display on notebook tabs:
image = image_trait
- imports
The valid categories of imported elements:
imports = imports_trait
- item_theme
The default theme to use for a contained item:
item_theme = ATheme
- key_bindings
The set of global key bindings for the view. Each time a key is pressed while the view has keyboard focus, the key is checked to see if it is one of the keys recognized by the KeyBindings object. If it is, the matching KeyBinding's method name is checked to see if it is defined on any of the object's in the view's context. If it is, the method is invoked. If the result of the method is False, then the search continues with the next object in the context. If any invoked method returns a non-False value, processing stops and the key is marked as having been handled. If all invoked methods return False, or no matching KeyBinding object is found, the key is processed normally. If the view has a non-empty id trait, the contents of the KeyBindings object will be saved as part of the view's persistent data:
key_bindings = key_bindings_trait
- kind
The kind of user interface to create:
kind = kind_trait
- label_theme
The default theme to use for a contained item's label:
label_theme = ATheme
- model_view
The factory function for converting a model into a model/view object:
model_view = model_view_trait
- object
The default object being edited:
object = object_trait
- ok
Should an OK button be added? (deprecated):
ok = ok_trait
- on_apply
Called when modal changes are applied or reverted:
on_apply = on_apply_trait
- resizable
Can the user resize the window?
resizable = resizable_trait
- revert
Should a Revert button be added? (deprecated):
revert = revert_trait
- scrollable
Can the user scroll the view? If set to True, window-level scroll bars appear whenever the window is too small to show all of its contents at one time. If set to False, the window does not scroll, but individual widgets might still contain scroll bars.
scrollable = scrollable_trait
- statusbar
Status bar items to add to the view's status bar. The value can be:
- None: No status bar for the view (the default).
- string: Same as [ StatusItem( name = string ) ].
- StatusItem: Same as [ StatusItem ].
- [ [StatusItem|string], ... ]: Create a status bar with one field for each StatusItem in the list (or tuple). The status bar fields are defined from left to right in the order specified. A string value is converted to: StatusItem( name = string ):
statusbar = ViewStatus
- style
The default editor style of elements in the view:
style = EditorStyle
- title
Title for the view, displayed in the title bar when the view appears as a secondary window (i.e., dialog or wizard). If not specified, "Edit properties" is used as the title.
title = title_trait
- toolbar
The toolbar for the view. Usually requires a custom handler:
toolbar = Any
- undo
Should Undo/Redo buttons be added? (deprecated):
undo = undo_trait
- updated
Event when the view has been updated:
updated = Event
- width
Requested width for the view window, as an (integer) number of pixels, or as a (floating point) fraction of the screen width.
width = width_trait
- x
Requested x-coordinate (horizontal position) for the view window. This attribute can be specified in the following ways:
- A positive integer: indicates the number of pixels from the left edge of the screen to the left edge of the window.
- A negative integer: indicates the number of pixels from the right edge of the screen to the right edge of the window.
- A floating point value between 0 and 1: indicates the fraction of the total screen width between the left edge of the screen and the left edge of the window.
- A floating point value between -1 and 0: indicates the fraction of the total screen width between the right edge of the screen and the right edge of the window.
x = x_trait
- y
Requested y-coordinate (vertical position) for the view window. This attribute behaves exactly like the x attribute, except that its value indicates the position of the top or bottom of the view window relative to the top or bottom of the screen.
y = y_trait
Inherited from base classes
Method summary
- __init__(self, *values, **traits)
- __repr__(self)
- replace_include(self, view_elements)
- set_content(self, *values)
- ui(self, context, parent = None, kind = None, view_elements = None, handler = None, id = '', scrollable = None, args = None)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- has_traits_interface(self, *interfaces)
- is_includable(self)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- __init__(self, *values, **traits)
Initializes the object.
- __repr__(self)
Returns a "pretty print" version of the View.
- replace_include(self, view_elements)
Replaces any items that have an ID with an Include object with the same ID, and puts the object with the ID into the specified ViewElements object.
- set_content(self, *values)
Sets the content of a view.
- ui(self, context, parent = None, kind = None, view_elements = None, handler = None, id = '', scrollable = None, args = None)
Creates a UI object, which generates the actual GUI window or panel from a set of view elements.
Parameters
- context : object or dictionary
- A single object or a dictionary of string/object pairs, whose trait attributes are to be edited. If not specified, the current object is used.
- parent : window component
- The window parent of the View object's window
- kind : string
- The kind of window to create. See the kind_trait trait for details. If kind is unspecified or None, the kind attribute of the View object is used.
- view_elements : ViewElements object
- The set of Group, Item, and Include objects contained in the view. Do not use this parameter when calling this method directly.
- handler : Handler object
- A handler object used for event handling in the dialog box. If None, the default handler for Traits UI is used.
- id : string
- A unique ID for persisting preferences about this user interface, such as size and position. If not specified, no user preferences are saved.
- scrollable : Boolean
- Indicates whether the dialog box should be scrollable. When set to True, scroll bars appear on the dialog box if it is not large enough to display all of the items in the view at one time.