0

How do you make a 4 (rows) by 7 (columns) of checkboxes using Flet? I can get all 28 checkboxes to be displayed, but can't get them into 4 rows of 7. Thanks!

dwburger
  • 51
  • 1
  • 6

1 Answers1

0

I was able to figure out the solution to my question:

import flet as ft

def main(page):
    DaysOfWeek = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
    checkboxes=[]
    for j in range(0,4):
        def boxes(count):
            boxes = []
            for i in range(0,7):
                boxes.append(ft.Checkbox(label=DaysOfWeek[i]))

                checkboxes.append(boxes)

            return boxes


        row2 = ft.Row(spacing=30, controls=boxes(7))
        page.add(row2)

        
ft.app(target=main)
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
dwburger
  • 51
  • 1
  • 6