Version

Quick search

Slider

_images/slider.jpg

The Slider widget looks like a scrollbar. It supports horizontal and vertical orientations, min/max values and a default value.

To create a slider from -100 to 100 starting from 25:

from kivy.uix.slider import Slider
s = Slider(min=-100, max=100, value=25)

To create a vertical slider:

from kivy.uix.slider import Slider
s = Slider(orientation='vertical')

To create a slider with a red line tracking the value:

from kivy.uix.slider import Slider
s = Slider(value_track=True, value_track_color=[1, 0, 0, 1])

Kv Example:

BoxLayout:
    Slider:
        id: slider
        min: 0
        max: 100
        step: 1
        orientation: 'vertical'

    Label:
        text: str(slider.value)
class kivy.uix.slider.Slider(**kwargs)

Bases: kivy.uix.widget.Widget

Class for creating a Slider widget.

Check module documentation for more details.

on_touch_down(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_move(touch)

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

See on_touch_down() for more information.

on_touch_up(touch)

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

See on_touch_down() for more information.