trait class

class traity.traits.trait(fget=None, fset=None, fdel=None, type=None, ftype=None, instance=None, fdefault=None)
  • fget – Is a function to be used for getting an attribute value.
  • fset – Is a function for setting
  • fdel – a function for del’ing, an attribute.
  • ftype – A type convert the argument to on set. type must be a function that accepts an argument and returns a single result. Like the builtin int
  • instance – The argument must be of this instance.
  • fdefault – Is a function to be called when the property is not set

delegate_trait class

class traity.traits.delegate_trait(outer, inner, *chain)



Statically Register a listener to a class:

def attr_changed(self, event):
    print 'hello!'


traity.traits.on_change(instance, traits, function, weak=None)

Register a listener to an object.

  • traits – either a string,, or a tuple of strings and listenables.
  • function – function to call when event with target target is triggered.
  • instance – The object to listen to events for.