Inherits from
- TraitType: enthought.traits.trait_handlers.TraitType
Attributes
Inherited from base classes
Method summary
- __init__(self, *types, **metadata)
- create_editor(self)
- full_info(self, object, name, value)
- init_fast_validator(self, *args)
- validate(self, object, name, value)
Inherited from base classes
- arg_error(self, method, arg_num, object, name, value)
- dup_arg_error(self, method, arg_num, object, name)
- error(self, object, name, value)
- get_editor(self, trait = None)
- info(self)
- inner_traits(self)
- is_valid(self, object, name, value)
- keyword_error(self, method, object, name, value)
- missing_arg_error(self, method, arg_num, object, name)
- repr(self, value)
- return_error(self, method, object, value)
Methods
- __init__(self, *types, **metadata)
Returns a Tuple trait.
Parameters
- types : zero or more arguments
- Definition of the default and allowed tuples. If the first item of types is a tuple, it is used as the default value. The remaining argument list is used to form a tuple that constrains the values assigned to the returned trait. The trait's value must be a tuple of the same length as the remaining argument list, whose elements must match the types specified by the corresponding items of the remaining argument list.
Default Value
- If no arguments are specified, the default value is ().
- If a tuple is specified as the first argument, it is the default value.
- If a tuple is not specified as the first argument, the default value is a tuple whose length is the length of the argument list, and whose values are the default values for the corresponding trait types.
Example for case #2:
mytuple = Tuple(('Fred', 'Betty', 5))The trait's value must be a 3-element tuple whose first and second elements are strings, and whose third element is an integer. The default value is ('Fred', 'Betty', 5).
Example for case #3:
mytuple = Tuple('Fred', 'Betty', 5)The trait's value must be a 3-element tuple whose first and second elements are strings, and whose third element is an integer. The default value is ('','',0).
- create_editor(self)
Returns the default UI editor for the trait.
- full_info(self, object, name, value)
Returns a description of the trait.
- init_fast_validator(self, *args)
Saves the validation parameters.
- validate(self, object, name, value)
Validates that the value is a valid tuple.