Я хочу иметь возможность динамически добавлять GridLayouts в один контейнер GridLayout.
мой код:
layout = GridLayout(cols=1, size_hint= (None,None))
...
get_score = data.get(key, {}).get('score')
can = self.root.get_screen("three")
for x in range(-1, get_score): # had to use -1 to get correct amount of shapes
can.ids.my_box.add_widget(layout)
кв:
GridLayout:
cols: 1
id: my_box
size_hint_y: None
height: self.minimum_height
row_force_default: True
row_default_height: 50
Когда я пытаюсь это сделать, я получаю ошибку
kivy.uix.widget.WidgetException: Cannot add <kivy.uix.gridlayout.GridLayout object at 0x00000274FEFD9B40>, it already has a parent <kivy.uix.gridlayout.GridLayout object at 0x00000274FEFD99A0>