bundles / traitlets 5.16.2 / traitlets / traitlets / link
class
traitlets.traitlets:link
source: /traitlets/traitlets.py:298
Signature
class link(source: t.Any, target: t.Any, transform: t.Iterable[FuncT] | None = None) → NoneMembers
Summary
Link traits from different objects together so they remain in sync.
Parameters
source: (object / attribute name) pairtarget: (object / attribute name) pairtransform: iterable with two callables (optional)Data transformation between source and target and target and source.
Examples
class X(HasTraits): value = Int()
src = X(value=1) tgt = X(value=42) c = link((src, "value"), (tgt, "value"))Setting source updates target objects:
src.value = 5 tgt.value
Aliases
traitlets.link