With the following definition
trait = Trait('default',{key1 : val1, key2 : val2, ...})
is it possible to change afterwards the dictionary associating traits and their mapped counterparts? This would allow to have an object-wise mapping and not a class-wise mapping.
The answer is 'yes'. Consider the following program:
from traits.api import HasTraits, Trait
from traitsui.api import View
class A(HasTraits):
a = Trait(0,{0 : 'Zero', 1 : 'One'})
a = A()
a.configure_traits(view=View('a','a_'))
When run, you have a drop box with 0 and 1 and the corresponding text below. It suffices to enter:
a.trait('a').handler.map = {0: 'new Zero', 1: 'new One'}
to have the new mapping