Reactive
The Reactive
class implements reactivity.
Reactive
class
¶
def __init__(
self,
default,
*,
layout=False,
repaint=True,
init=False,
always_update=False,
compute=True
):
Bases: Generic[ReactiveType]
Reactive descriptor.
Parameters
Parameter | Default | Description |
---|---|---|
default
ReactiveType | Callable[[], ReactiveType]
|
required | A default value or callable that returns a default. |
layout
bool
|
False
|
Perform a layout on change. |
repaint
bool
|
True
|
Perform a repaint on change. |
init
bool
|
False
|
Call watchers on initialize (post mount). |
always_update
bool
|
False
|
Call watchers even when the new value equals the old value. |
compute
bool
|
True
|
Run compute methods when attribute is changed. |
TooManyComputesError
class
¶
Bases: Exception
Raised when an attribute has public and private compute methods.
reactive
class
¶
Bases: Reactive[ReactiveType]
Create a reactive attribute.
Parameters
Parameter | Default | Description |
---|---|---|
default
ReactiveType | Callable[[], ReactiveType]
|
required | A default value or callable that returns a default. |
layout
bool
|
False
|
Perform a layout on change. |
repaint
bool
|
True
|
Perform a repaint on change. |
init
bool
|
True
|
Call watchers on initialize (post mount). |
always_update
bool
|
False
|
Call watchers even when the new value equals the old value. |
var
class
¶
Bases: Reactive[ReactiveType]
Create a reactive attribute (with no auto-refresh).
Parameters
Parameter | Default | Description |
---|---|---|
default
ReactiveType | Callable[[], ReactiveType]
|
required | A default value or callable that returns a default. |
init
bool
|
True
|
Call watchers on initialize (post mount). |
always_update
bool
|
False
|
Call watchers even when the new value equals the old value. |