1# 2# Demonstrate track placement 3# 4 5col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] 6row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST] 7 8 9# Add space between the columns and move the rows to the bottom (end) 10 11# Create a container with grid 12cont = lv.obj(lv.scr_act()) 13cont.set_grid_align(lv.GRID_ALIGN.SPACE_BETWEEN, lv.GRID_ALIGN.END) 14cont.set_grid_dsc_array(col_dsc, row_dsc) 15cont.set_size(300, 220) 16cont.center() 17 18 19for i in range(9): 20 col = i % 3 21 row = i // 3 22 23 obj = lv.obj(cont) 24 # Stretch the cell horizontally and vertically too 25 # Set span to 1 to make the cell 1 column/row sized 26 obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, col, 1, 27 lv.GRID_ALIGN.STRETCH, row, 1) 28 29 label = lv.label(obj) 30 label.set_text("{:d}{:d}".format(col, row)) 31 label.center() 32 33