Link a source widget’s trait into a target’s, with an optional linear transform
(multiplier/offset) or a nested dotted-path target.
Import¶
from manywidgets import BinderExample¶
Drag the slider — the chart’s width follows value × 100:
import numpy as np
from manywidgets import Slider, Chart, Binder
x = np.linspace(0, 10, 100)
chart = Chart(title="sin")
chart.add_series(x=x, y=np.sin(x), name="sin")
width = Slider(label="Width", min=4, max=12, value=8)
binder = Binder(source=width, source_field="value",
target=chart, target_field="width", multiplier=100)
display(width, chart, binder)API¶
| Trait | Type | Default | Description |
|---|---|---|---|
source_widget_id | Unicode | '' | widget_id of the source widget. |
source_field | Unicode | 'value' | Source trait to read. |
target_widget_id | Unicode | '' | widget_id of the target widget. |
target_field | Unicode | '' | Target trait/dotted-path to write (e.g. ‘view_state.zoom’). |
multiplier | Float | 1.0 | Linear transform multiplier. |
offset | Float | 0.0 | Linear transform offset. |
label | Unicode | '' | Optional status label. |
widget_id | Unicode | '' | Stable unique id used for cross-widget linking (auto-assigned). |
Binder covers what jslink/jsdlink can’t: a linear transform on the value, or
writing a nested dotted-path target (e.g. target_field="view_state.zoom"),
merged into the parent dict. For plain pass-through links, prefer jslink — see the
linking guide.