I think it's a noob question, but I have not found a solution at the moment.
Suppose I have an app like this:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
kv = '''
<MyLayout>:
canvas:
Color
rgb: (1, 0, 1)
Rectangle
pos: (self.pos[0]+10,self.pos[1]+10)
size: (self.size[0]-20,self.size[1]-20)
BoxLayout
MyLayout
Label
text:'123'
MyLayout
Label
text:'456'
'''
class MyLayout(BoxLayout):
pass
class TestApp(App):
def build(self):
return Builder.load_string(kv)
TestApp().run()
Can I write in the kv something like:
<MyLayout>:
canvas:
Color
rgb: (1, 0, 1)
Rectangle
pos: (self.pos[0]+10,self.pos[1]+10)
size: (self.size[0]-20,self.size[1]-20)
Label
id:l
BoxLayout
MyLayout
l.text:'123'
MyLayout
l.text:'456'
(not to write each time the word Label inside MyLayout)?