Saturday, August 14, 2021

kv 32 switch slider


#slider.kv
BoxLayout:
    size: root.width, root.height
    Switch:
        id: switch1
        size_hint: None, 1
        #on_active: root.on_switch_active(self)
        active: True
    Slider:
        id: slider1
        min: 0
        max: 100
        value: 50
        #on_value: ...
        orientation: "vertical"
        disabled: not switch1.active
    Label:
        text: str(int(slider1.value))
        font_name: "font/LCD.ttf"
        font_size: "200dp"

----------------------
#slider.py
from kivy.app import App
from kivy.uix.widget import Widget


class Slider(Widget):
    pass

class SliderApp(App):
    pass


SliderApp().run()

reference:

No comments:

Post a Comment