traitsui.item module

Defines the Item class, which is used to represent a single item within a Traits-based user interface.

class traitsui.item.Custom(value=None, **traits)

Bases: traitsui.item.Item

An Item using a ‘custom’ style.

class traitsui.item.Heading(label, **traits)

Bases: traitsui.item.Label

An item that is a fancy label.

class traitsui.item.Item(value=None, **traits)

Bases: traitsui.view_element.ViewSubElement

An element in a Traits-based user interface.

Magic:

  • Items are rendered as layout elements if name is set to special values:
    • name='', the item is rendered as a static label
    • name='_', the item is rendered as a separator
    • name=' ', the item is rendered as a 5 pixel spacer
    • name='23' (any number), the item is rendered as a spacer of the size specified (number of pixels)
get_help(ui)

Gets the help text associated with the Item in a specified UI.

get_id()

Returns an ID used to identify the item.

get_label(ui)

Gets the label to use for a specified Item.

If not specified, the label is set as the name of the corresponding trait, replacing ‘_’ with ‘ ‘, and capitalizing the first letter (see user_name_for()). This is called the user name.

Magic:

  • if attr:item.label is specified, and it begins with ‘…’, the final label is the user name followed by the item label
  • if attr:item.label is specified, and it ends with ‘…’, the final label is the item label followed by the user name
is_includable()

Returns a Boolean indicating whether the object is replaceable by an Include object.

is_spacer()

Returns True if the item represents a spacer or separator.

class traitsui.item.Label(label, **traits)

Bases: traitsui.item.Item

An item that is a label.

class traitsui.item.Readonly(value=None, **traits)

Bases: traitsui.item.Item

An Item using a ‘readonly’ style.

class traitsui.item.Spring(value=None, **traits)

Bases: traitsui.item.Item

An item that is a layout “spring”.

class traitsui.item.UCustom(value=None, **traits)

Bases: traitsui.item.Custom

An Item using a ‘custom’ style with no label.

class traitsui.item.UItem(value=None, **traits)

Bases: traitsui.item.Item

An Item that has no label.

class traitsui.item.UReadonly(value=None, **traits)

Bases: traitsui.item.Readonly

An Item using a ‘readonly’ style with no label.

Previous topic

traitsui.instance_choice module

Next topic

traitsui.key_bindings module

This Page