<InterLength>
FloatLayout:
canvas:
Rectangle:
size: self.size
pos: self.pos
source: 'bgnd.jpg'
Color:
rgba: 0,0.5,0.5,1
Rectangle:
id: rect1
size: (15,50)
pos: (50,450)
Color:
rgba: 0.2,1,0.2,1
Rectangle:
id: rect2
size: (105,50)
pos:(50,250)
FloatLayout:
Slider:
id: slider
min: 0
max: 50
step: 1
orientation: 'horizontal'
pos_hint: {"x": 0.004, "top": 0.73}
Label:
text: str(slider.value)
There are a number of things gong on here that are not quite correct.
You have a label in a slider. You have assigned ids to drawing instructions in the canvas. Ids are for widgets.
I put the canvas in the Slider widget and use self.value to change the size of the drawn objects.
from kivy.app import App
from kivy.lang import Builder
kv = """
<InterLength@BoxLayout>:
orientation: 'vertical'
canvas:
Color:
rgba: .5, .5, .5, 1
Rectangle:
size: self.size
pos: self.pos
source: 'bgnd.jpg'
Slider:
size_hint_y: .25
id: slider
min: 0
max: 50
step: 1
orientation: 'horizontal'
canvas:
Color:
rgba: 0,0.5,0.5,1
Rectangle:
size: (15 + self.value * 20, 50)
pos: (50 ,450)
Color:
rgba: 0.2,1,0.2,1
Rectangle:
size: (105, 50 + self.value * 5)
pos:(50,250)
Label:
text: str(slider.value)
font_size: 40
Label:
text: 'Slider Value Test'
InterLength:
"""
class SizeBoxApp(App):
def build(self):
return Builder.load_string(kv)
SizeBoxApp().run()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/a9f3b420-65a2-4980-920d-4e5a31ce8fdd%40googlegroups.com.