API Reference for Enthought Tool Suite 3.2.0

Ensures that values assigned to a trait attribute are tuples of a specified length, with elements that are of specified types.

TraitTuple is the underlying handler for the predefined trait Tuple, and the trait factory Tuple().

For example:

rank = Range(1, 13)
suit = Trait('Hearts', 'Diamonds', 'Spades', 'Clubs')
class Card(HasTraits):
    value = Trait(TraitTuple(rank, suit))

This example defines a Card class, which has a value trait attribute, which must be a tuple of two elments. The first element must be an integer in the range from 1 to 13, and the second element must be one of the four strings, 'Hearts', 'Diamonds', 'Spades', or 'Clubs'.

Inherits from

Attributes

Inherited from base classes

Method summary

Inherited from base classes

Methods

© Copyright 2002-2009 Enthought, Inc.