StateIcon#
StateIcon is a custom widget to provide easy to use a mutable icon state: displaying a short description of the state with a tooltip and a descriptive color. This widget is intended to be linked with a SepalModel trait, which will be in charge of changing the widget state. Here is an example:
import ipyvuetify as v
from traitlets import Unicode
from pysepal import sepalwidgets as sw
from pysepal.model import Model
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
# Define a dummy model to manipulate externally the icon state
class TestModel(Model):
state_value = Unicode().tag(sync=True)
model = TestModel()
state_icon_a = sw.StateIcon(model, "state_value")
state_icon_b = sw.StateIcon(model, "state_value")
state_icon_b.value = "non_valid"
sw.Col(children=[
sw.Flex(xs12=True, children=[state_icon_a]),
sw.Divider(class_="my-5"),
sw.Flex(xs12=True, children=[state_icon_b]),
])
/home/docs/checkouts/pysepal/envs/latest/lib/python3.10/site-packages/google/api_core/_python_version_support.py:212: FutureWarning: You are using a non-supported Python version (3.10.20). Google will not post any further updates to google.api_core supporting this Python version. Please upgrade to the latest Python version, or at least Python 3.11, and then update google.api_core. warnings.warn(message, FutureWarning)
Note
More information can be found here.