SepalWidget#
Overview#
SepalWidget is an abstract object that embed special methods, it can be used with any ipyvuetify widget component:
from pysepal import sepalwidgets as sw
import ipyvuetify as v
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
class SepalSelect(sw.SepalWidget, v.Select):
def __init__(self, **kwargs):
super().__init__(**kwargs)
sepal_select = SepalSelect()
sepal_select
/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.10/site-packages/google/api_core/_python_version_support.py:273: FutureWarning: You are using a Python version (3.10.19) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date. warnings.warn(message, FutureWarning)
Methods#
This abstract class add 3 method to the ipyvuetify objects
hide#
Hide the component by changing its class.
from pysepal import sepalwidgets as sw
import ipyvuetify as v
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
class SepalSelect(sw.SepalWidget, v.Select):
def __init__(self, **kwargs):
super().__init__(**kwargs)
sepal_select = SepalSelect()
sepal_select.hide()
Note
the component can also be hidden by setting:
sepal_select.viz = False
show#
Show the component by changing its class.
from pysepal import sepalwidgets as sw
import ipyvuetify as v
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
class SepalSelect(sw.SepalWidget, v.Select):
def __init__(self, **kwargs):
super().__init__(**kwargs)
sepal_select = SepalSelect()
sepal_select.hide().show()
Note
the component can also be shown by setting:
sepal_select.viz = True
reset#
remove the v_model of the component and replace it by None.
from pysepal import sepalwidgets as sw
import ipyvuetify as v
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
class SepalTextField(sw.SepalWidget, v.TextField):
def __init__(self, **kwargs):
super().__init__(**kwargs)
sepal_select = SepalTextField(v_model='toto')
print(sepal_select.v_model)
sepal_select.reset()
toto
Note
More information can be found here.