{ } Raw JSON

bundles / traitlets 5.16.2 / traitlets / traitlets / directional_link

class

traitlets.traitlets:directional_link

source: /traitlets/traitlets.py:385

Signature

class directional_link(source: t.Any, target: t.Any, transform: t.Any = None) → None

Members

Summary

Link the trait of a source object with traits of target objects.

Parameters

source : (object, attribute name) pair
target : (object, attribute name) pair
transform: callable (optional)

Data transformation between source and target.

Examples

class X(HasTraits):
    value = Int()
src = X(value=1)
tgt = X(value=42)
c = directional_link((src, "value"), (tgt, "value"))
Setting source updates target objects:
src.value = 5
tgt.value
Setting target does not update source object:
tgt.value = 6
src.value

Aliases

  • traitlets.directional_link