5 Sep 21:43
[Traits] dirty trait metadata
Hi,
Consider the following:
-----------------
from numpy import *
from enthought.traits.api import *
class Data(HasTraits):
x = Array
def _x_changed(self, value):
print value
x = linspace(0, 1)
d = Data(x=x)
-------------------
Now I'd like to always call _x_changed when the x trait is set. Thus,
I'd like this to work:
x *= 2
d.x = x # Should call _x_changed
Is there a simple way of doing this? I know that I could achieve this
if I implemented x as a Property(Array) but is there an easier way?
Thanks.
prabhu
RSS Feed