VariableSynchronizer
current_namespace: VariableNamespace
__init__(self, name, namespace=None, value=None, callbacks=(), output_pane=None, autounlink=True):
LLM Docstring
A reactive variable that synchronizes its value across linked widgets and fires callbacks on change.
name:Anythe variable name
namespace:Anythe owning namespace
value:Anythe initial value
callbacks:Anychange callbacks
output_pane:Anythe output pane for error display
autounlink:boolunlink other widgets when a new one links
__repr__(self):
LLM Docstring
Return a representation showing the name and value.
:returns:strthe representation
@classmethod
create_var(cls, var, namespace=None, **opts):
LLM Docstring
Resolve a name (or synchronizer) to a VariableSynchronizer in the namespace,
creating and caching it if needed, and registering it with the active variable
set.
var:Anythe variable name or synchronizer
namespace:Anythe namespace (defaults to the current one)
:returns:VariableSynchronizerthe variable
@property
name(self):
LLM Docstring
The variable’s name.
:returns:_the name
@property
value(self):
LLM Docstring
The variable’s current value. Setting it propagates to linked widgets and fires the change callbacks.
:returns:_the value
set_value(self, v, caller=None):
LLM Docstring
Set the value (if changed), firing the change callbacks and propagating to every linked widget except the caller.
v:Anythe new value
caller:Anythe widget that triggered the change (not re-notified)
link(self, widget):
LLM Docstring
Link a widget to the variable: seed the variable from the widget’s value, observe
the widget for changes, and (if autounlink) unlink other widgets.
widget:Anythe widget to link
unlink(self, widget):
LLM Docstring
Unlink a widget from the variable, removing its change observers.
widget:Anythe widget to unlink