from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ListProperty
Builder.load_string(
    """
<TestGUI>:
    canvas.before:
        Color:
            rgba: (1, 0, 0, 1)
        Rectangle:
            size: self.temp_size
"""
    )


class TestGUI(BoxLayout):
    temp_size = ListProperty([0, 0])

def __init__(self, **kwargs):
    super(TestGUI, self).__init__(**kwargs)
print(self.size)
self.temp_size = [(0.5 * x) for x in self.size]


class TestApp(App):

    def build(self):
        return TestGUI()
if __name__ == '__main__':
    TestApp().run()
Accessing Kivy layout size in kvlang