traitsui.instance_choice module

Defines the various instance descriptors used by the instance editor and instance editor factory classes.

class traitsui.instance_choice.InstanceChoice

Bases: traitsui.instance_choice.InstanceChoiceItem

get_name(object=None)

Returns the name of the item.

get_object()

Returns the object associated with the item.

is_compatible(object)

Indicates whether a specified object is compatible with the item.

name_trait = Str("name")

The name of the object trait containing its user interface name:

object = Any()

Object associated with the item

class traitsui.instance_choice.InstanceChoiceItem

Bases: traits.has_traits.HasPrivateTraits

get_name(object=None)

Returns the name of the item.

get_object()

Returns the object associated with the item.

get_view()

Returns the view associated with the object.

is_compatible(object)

Indicates whether a specified object is compatible with the item.

is_droppable()

Indicates whether the item supports drag and drop.

is_factory = Bool(False)

Does this item create new instances?

is_selectable()

Indicates whether the item can be selected by the user.

name = Str()

User interface name for the item

view = AView

View associated with this item

class traitsui.instance_choice.InstanceDropChoice

Bases: traitsui.instance_choice.InstanceFactoryChoice

droppable = True

Indicates whether an instance compatible with this item can be dragged and dropped rather than created . This value overrides the default.

is_factory = False

Does this item create new instances? This value overrides the default.

selectable = False

Indicates whether the item can be selected by the user. This value overrides the default.

class traitsui.instance_choice.InstanceFactoryChoice

Bases: traitsui.instance_choice.InstanceChoiceItem

args = Tuple()

Tuple of arguments to pass to klass to create an instance

droppable = Bool(False)

Indicates whether an instance compatible with this item can be dragged and dropped rather than created

get_name(object=None)

Returns the name of the item.

get_object()

Returns the object associated with the item.

is_compatible(object)

Indicates whether a specified object is compatible with the item.

is_droppable()

Indicates whether the item supports drag and drop.

is_factory = True

Does this item create new instances? This value overrides the default.

is_selectable()

Indicates whether the item can be selected by the user.

klass = Callable()

A class (or other callable) that can be used to create an item compatible with this item

kw_args = Dict(Str, Any)

Dictionary of arguments to pass to klass to create an instance

selectable = Bool(True)

Indicates whether the item can be selected by the user