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_6.py (705B)

      1 #
      2 # Demonstrate RTL direction on grid
      3 #
      4 col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST]
      5 row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST]
      6 
      7 # Create a container with grid
      8 cont = lv.obj(lv.scr_act())
      9 cont.set_size(300, 220)
     10 cont.center()
     11 cont.set_style_base_dir(lv.BASE_DIR.RTL,0)
     12 cont.set_grid_dsc_array(col_dsc, row_dsc)
     13 
     14 for i in range(9):
     15     col = i % 3
     16     row = i // 3
     17 
     18     obj = lv.obj(cont)
     19     # Stretch the cell horizontally and vertically too
     20     # Set span to 1 to make the cell 1 column/row sized
     21     obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, col, 1,
     22                       lv.GRID_ALIGN.STRETCH, row, 1)
     23 
     24     label = lv.label(obj)
     25     label.set_text("{:d},{:d}".format(col, row))
     26     label.center()
     27