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_1.py (736B)

      1 #
      2 # A simple grid
      3 #
      4 
      5 col_dsc = [70, 70, 70, lv.GRID_TEMPLATE.LAST]
      6 row_dsc = [50, 50, 50, lv.GRID_TEMPLATE.LAST]
      7 
      8 # Create a container with grid
      9 cont = lv.obj(lv.scr_act())
     10 cont.set_style_grid_column_dsc_array(col_dsc, 0)
     11 cont.set_style_grid_row_dsc_array(row_dsc, 0)
     12 cont.set_size(300, 220)
     13 cont.center()
     14 cont.set_layout(lv.LAYOUT_GRID.value)
     15 
     16 for i in range(9):
     17     col = i % 3
     18     row = i // 3
     19 
     20     obj = lv.btn(cont)
     21     # Stretch the cell horizontally and vertically too
     22     # Set span to 1 to make the cell 1 column/row sized
     23     obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, col, 1,
     24                       lv.GRID_ALIGN.STRETCH, row, 1)
     25 
     26     label = lv.label(obj)
     27     label.set_text("c" +str(col) +  "r" +str(row))
     28     label.center()
     29