{ } Raw JSON

bundles / traitlets 5.15.0 / traitlets / traitlets / link

class

traitlets.traitlets:link

source: /traitlets/traitlets.py :275

Signature

class   link ( source : t.Any target : t.Any transform : t.Iterable[FuncT] | None = None )  →  None

Members

Summary

Link traits from different objects together so they remain in sync.

Parameters

source : (object / attribute name) pair
target : (object / attribute name) pair
transform: 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