Traits¶
trait class¶
-
class
traity.traits.
trait
(fget=None, fset=None, fdel=None, type=None, ftype=None, instance=None, fdefault=None)¶ Parameters: - 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
Functions¶
-
traity.traits.
on_trait_change
(traits)¶ Statically Register a listener to a class:
@on_trait_change('attr') def attr_changed(self, event): print 'hello!'
.
-
traity.traits.
on_change
(instance, traits, function, weak=None)¶ Register a listener to an object.
Parameters: - traits – either a string, traity.events.listenable, 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.