Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display kivy slider value as it changes [closed]

I was wondering whether it was possible to displays kivy spinner values as a moving label, so that the user knows exactly what the current value of the slider is.

Thanks

like image 456
The armateur Avatar asked Apr 02 '14 18:04

The armateur


1 Answers

you just bind a listener to the value change event

some_label = Label(...)
my_slider = Slider(...)
def OnSliderValueChange(instance,value):
    some_label.text = str(value)

my_slider.bind(value=OnSliderValueChange)

as inclement points out in the .kv file you could do something like

<PongGame>:
    ...
    canvas:
        Rectangle:
            ...
    Label:
        ...
        text: str(slider_id.value)
     Slider:
        ...
        id: slider_id
like image 75
Joran Beasley Avatar answered Oct 14 '22 02:10

Joran Beasley