SepalWidget#
Overview#
SepalWidget
is an abstract object that embed special methods, it can be used with any ipyvuetify widget component:
from sepal_ui 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
Methods#
This abstract class add 3 method to the ipyvuetify objects
hide#
Hide the component by changing its class.
from sepal_ui 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 sepal_ui 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 sepal_ui 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.