I have a dynamic classes like this:
<BLMother@BoxLayout>:
orientation:"horizontal"
padding: 10, 0
spacing: 10
For some of my CustomBoxLayout, I would like to add a canvas:before. I could create a new dynamic classes which combine the values of both like this:
<BLChildren@BoxLayout>:
orientation:"horizontal"
padding: 10, 0
spacing: 10
canvas.before:
Color:
rgba: 1, 1, 1, 0.8
Rectangle:
size: self.size
pos: self.x + self.width*0.025, self.y
Is there a way BLChildren
can inherit all the value from BLMother
?
I use Kivy (1.10.1.dev0)
Yes, the BLChildren can inherit all the value from BLMother. Please refer to the example below for details.
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
class RootWidget(FloatLayout):
pass
class TestApp(App):
title = "With Inheritance of BLMother"
def build(self):
return RootWidget()
if __name__ == "__main__":
TestApp().run()
#:kivy 1.10.0
<BLMother@BoxLayout>:
orientation:"horizontal"
padding: 10, 0
spacing: 10
<BLChildren@BoxLayout>:
canvas.before:
Color:
rgba: 1, 1, 1, 0.8
Rectangle:
size: self.size
pos: self.x + self.width*0.025, self.y
BLMother:
<RootWidget>:
BLChildren: