I have a kivy screen that I need to create elements in via a loop. I can do it as so:
class HomeScreen(Screen):
def show_tasks(self):
global user
tasks = DB.get_tasks(user) # Returns an array of tuples
for task in tasks:
self.add_widget(Label(text=task[1]))
However, when I do it this way, the labels overlap on top of each other - literally on the z axis, making them all unreadable. Instead I want them to populate one above the other (on the y axis). Not only that, but eventually I'm going to want to create a table-like structure out of the data.
Here's my kv:
<HomeScreen>:
name: 'home'
FloatLayout:
BoxLayout:
orientation: "horizontal"
pos_hint: {"x": 0, "y": 0}
GridLayout:
id: grid
rows: 4
cols: 1
padding: 10
spacing: 10
row_force_default: True
row_default_height: 40
Label:
text: 'Your Tasks:'
size_hint_x: None
width: 200
font_size: 24
Any help or insight into how I can solve this problem would be greatly appreciated!