API Reference for Enthought Tool Suite 3.2.0

A cross between the TraitPrefixList and TraitMap classes.

Like TraitMap, TraitPrefixMap is created using a dictionary, but in this case, the keys of the dictionary must be strings. Like TraitPrefixList, a string v is a valid value for the trait attribute if it is a prefix of one and only one key k in the dictionary. The actual values assigned to the trait attribute is k, and its corresponding mapped attribute is map*[*k].

Example

boolean_map = Trait('true', TraitPrefixMap( {
                                'true': 1,
                                'yes': 1,
                                'false': 0,
                                'no': 0 } ))

This example defines a Boolean trait that accepts any prefix of 'true', 'yes', 'false', or 'no', and maps them to 1 or 0.

Inherits from

Attributes

Inherited from base classes

Method summary

Inherited from base classes

Methods

© Copyright 2002-2009 Enthought, Inc.