traitsui.view module

Defines the View class used to represent the structural content of a Traits-based user interface.

class traitsui.view.View(*values, **traits)

Bases: traitsui.view_element.ViewElement

A Traits-based user interface for one or more objects.

The attributes of the View object determine the contents and layout of an attribute-editing window. A View object contains a set of Group, Item, and Include objects. A View object can be an attribute of an object derived from HasTraits, or it can be a standalone object.

replace_include(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(*values)

Sets the content of a view.

ui(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 AKind 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.

Previous topic

traitsui.value_tree module

Next topic

traitsui.view_element module

This Page