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: Any

    the variable name

  • namespace: Any

    the owning namespace

  • value: Any

    the initial value

  • callbacks: Any

    change callbacks

  • output_pane: Any

    the output pane for error display

  • autounlink: bool

    unlink other widgets when a new one links

 

__repr__(self): 

LLM Docstring

Return a representation showing the name and value.

  • :returns: str

    the 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: Any

    the variable name or synchronizer

  • namespace: Any

    the namespace (defaults to the current one)

  • :returns: VariableSynchronizer

    the 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: Any

    the new value

  • caller: Any

    the 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: Any

    the widget to link

 

unlink(self, widget): 

LLM Docstring

Unlink a widget from the variable, removing its change observers.

  • widget: Any

    the widget to unlink


Feedback

Examples

Templates

Documentation