标签:import vertica ref uil sel out str 文件 自定义控件
lableSlider1.kv文件<LabelSlider>:
orientation:‘vertical‘
BoxLayout:
MyLabelSlider:
name: ‘Slider1‘
onValue: root.onMySlider
id:mySlider
Label:
text:str(mySlider.ids.slider.value)
BoxLayout:
orientation:‘vertical‘
MyLabelSlider:
name: ‘slider2‘
MyLabelSlider:
name: ‘slider3‘
MyLabelSlider:
name: ‘slider4‘
MyLabelSlider:
name: ‘slider5‘
<MyLabelSlider@BoxLayout>:
name: ‘Slider‘
onValue: lambda value: print(‘MyLabelSlider no onValue function:‘,value)
Label:
text:root.name
Slider:
id:slider
on_value:root.onValue(self.value)labelSlider.py文件from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class LabelSlider(BoxLayout):
def onMySlider(self, value):
print(value)
pass
class LabelSlider1App(App):
def build(self):
return LabelSlider()
if __name__ == ‘__main__‘:
LabelSlider1App().run()
标签:import vertica ref uil sel out str 文件 自定义控件
原文地址:http://www.cnblogs.com/kivy/p/kivy-custom-widget-label-Slider.html