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_2.py (1712B)

      1 #
      2 # Demonstrate cell placement and span
      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_grid_dsc_array(col_dsc, row_dsc)
     11 cont.set_size(300, 220)
     12 cont.center()
     13 
     14 # Cell to 0;0 and align to the start (left/top) horizontally and vertically too
     15 obj = lv.obj(cont)
     16 obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
     17 obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,
     18                   lv.GRID_ALIGN.START, 0, 1)
     19 label = lv.label(obj)
     20 label.set_text("c0, r0")
     21 
     22 # Cell to 1;0 and align to the start (left) horizontally and center vertically too
     23 obj = lv.obj(cont)
     24 obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
     25 obj.set_grid_cell(lv.GRID_ALIGN.START, 1, 1,
     26                   lv.GRID_ALIGN.CENTER, 0, 1)
     27 label = lv.label(obj)
     28 label.set_text("c1, r0")
     29 
     30 # Cell to 2;0 and align to the start (left) horizontally and end (bottom) vertically too
     31 obj = lv.obj(cont)
     32 obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
     33 obj.set_grid_cell(lv.GRID_ALIGN.START, 2, 1,
     34                   lv.GRID_ALIGN.END, 0, 1)
     35 label = lv.label(obj)
     36 label.set_text("c2, r0")
     37 
     38 # Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.
     39 obj = lv.obj(cont)
     40 obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
     41 obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 1, 2,
     42                   lv.GRID_ALIGN.STRETCH, 1, 1)
     43 label = lv.label(obj)
     44 label.set_text("c1-2, r1")
     45 
     46 # Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.
     47 obj = lv.obj(cont)
     48 obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
     49 obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 0, 1,
     50                   lv.GRID_ALIGN.STRETCH, 1, 2)
     51 label = lv.label(obj)
     52 label.set_text("c0\nr1-2")