Range Slider¶
Last Updated: August 10, 2015
- class tethys_sdk.gizmos.RangeSlider(name, min, max, initial, step, disabled=False, display_text='', error='', attributes={}, classes='')¶
Sliders can be used to request an input value from a range of possible values. A slider is configured with a dictionary of key-value options. The table below summarizes the options for sliders.
- display_text¶
str
Display text for the label that accompanies slider
- name¶
str, required
Name of the input element that will be used on form submission
- min¶
int, required
Minimum value of range
- max¶
int, required
Maximum value of range
- initial¶
int, required
Initial value of slider
- step¶
int, required
Increment between values in range
- disabled¶
bool
Disabled state of the slider
- error¶
str
Error message for form validation
- attributes¶
dict
A dictionary representing additional HTML attributes to add to the primary element (e.g. {“onclick”: “run_me();”}).
- classes¶
str
Additional classes to add to the primary HTML element (e.g. “example-class another-class”).
Example
# CONTROLLER from tethys_sdk.gizmos import RangeSlider slider1 = RangeSlider(display_text='Slider 1', name='slider1', min=0, max=100, initial=50, step=1) slider2 = RangeSlider(display_text='Slider 2', name='slider2', min=0, max=1, initial=0.5, step=0.1, disabled=True, error='Incorrect, please choose another value.') # TEMPLATE {% gizmo range_slider slider1 %} {% gizmo range_slider slider2 %}