Slider

Sliders allow users to make selections from a range of values.

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/slider.png

With value hint

from kivy.lang import Builder

from kivymd.app import MDApp

KV = '''
Screen

    MDSlider:
        min: 0
        max: 100
        value: 40
'''


class Test(MDApp):
    def build(self):
        return Builder.load_string(KV)


Test().run()
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/slider-1.gif

Without value hint

MDSlider:
    min: 0
    max: 100
    value: 40
    hint: False
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/slider-2.gif

Without custom color

MDSlider:
    min: 0
    max: 100
    value: 40
    hint: False
    color: app.theme_cls.accent_color
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/slider-3.png

API - kivymd.uix.slider

class kivymd.uix.slider.MDSlider(**kwargs)

Class for creating a Slider widget.

Check module documentation for more details.

active

If the slider is clicked.

active is an BooleanProperty and defaults to False.

hint

If True, then the current value is displayed above the slider.

hint is an BooleanProperty and defaults to True.

hint_bg_color

Hint rectangle color in rgba format.

hint_bg_color is an ColorProperty and defaults to None.

hint_text_color

Hint text color in rgba format.

hint_text_color is an ColorProperty and defaults to None.

hint_radius

Hint radius.

hint_radius is an NumericProperty and defaults to 4.

show_off

Show the ‘off’ ring when set to minimum value.

show_off is an BooleanProperty and defaults to True.

color

Color slider in rgba format.

color is an ColorProperty and defaults to None.

on_hint(self, instance, value)
on_value_normalized(self, *args)

When the value == min set it to ‘off’ state and make slider a ring.

on_show_off(self, *args)
on__is_off(self, *args)
on_active(self, *args)
on_touch_down(self, touch)

Receive a touch down event.

Parameters
touch: MotionEvent class

Touch received. The touch is in parent coordinates. See relativelayout for a discussion on coordinate systems.

Returns

bool If True, the dispatching of the touch event will stop. If False, the event will continue to be dispatched to the rest of the widget tree.

on_touch_up(self, touch)

Receive a touch up event. The touch is in parent coordinates.

See on_touch_down() for more information.