traits.ctrait Module

Defines the core CTrait class.

The CTrait class extends the C-level cTrait type to provide the full CTrait API. CTraits are the core objects that are used to generate defaults and validate as well as maintaining a list of notifiers and calling them when values are modified.


class traits.ctrait.CTrait[source]

Extends the underlying C-based cTrait type.

property comparison_mode

Get or set the comparison mode on the trait. Getter returns a ComparisonMode enum. Setter acceps either an int or a ComparisonMode enum.

property property_fields

Return a tuple of callables (fget, fset, validate) for the property trait.


Returns whether or not this trait is of a specified trait type.


Returns the user interface editor associated with the trait.


Returns the help text for a trait.

If full is False or the trait does not have a help string, the returned string is constructed from the desc attribute on the trait and the info string on the trait’s handler.


full (bool) – Indicates whether to return the value of the help attribute of the trait itself.

full_info(object, name, value)[source]

Returns a description of the trait.


Returns a description of the trait.


Method that returns self for trait converters.