acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_grid_4.py (797B)
1 # 2 # Demonstrate track placement 3 # 4 5 col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] 6 row_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 12 cont = lv.obj(lv.scr_act()) 13 cont.set_grid_align(lv.GRID_ALIGN.SPACE_BETWEEN, lv.GRID_ALIGN.END) 14 cont.set_grid_dsc_array(col_dsc, row_dsc) 15 cont.set_size(300, 220) 16 cont.center() 17 18 19 for 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