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_5.py (1286B)
1 def row_gap_anim(obj, v): 2 obj.set_style_pad_row(v, 0) 3 4 def column_gap_anim(obj, v): 5 obj.set_style_pad_column(v, 0) 6 7 # 8 # Demonstrate column and row gap 9 # 10 11 # 60x60 cells 12 col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] 13 row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST] 14 15 # Create a container with grid 16 cont = lv.obj(lv.scr_act()) 17 cont.set_size(300, 220) 18 cont.center() 19 cont.set_grid_dsc_array(col_dsc, row_dsc) 20 21 for i in range(9): 22 col = i % 3 23 row = i // 3 24 25 obj = lv.obj(cont) 26 obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, col, 1, 27 lv.GRID_ALIGN.STRETCH, row, 1) 28 label = lv.label(obj) 29 label.set_text("{:d},{:d}".format(col, row)) 30 label.center() 31 32 a_row = lv.anim_t() 33 a_row.init() 34 a_row.set_var(cont) 35 a_row.set_values(0, 10) 36 a_row.set_repeat_count(lv.ANIM_REPEAT.INFINITE) 37 a_row.set_time(500) 38 a_row.set_playback_time(500) 39 a_row. set_custom_exec_cb(lambda a,val: row_gap_anim(cont,val)) 40 lv.anim_t.start(a_row) 41 42 a_col = lv.anim_t() 43 a_col.init() 44 a_col.set_var(cont) 45 a_col.set_values(0, 10) 46 a_col.set_repeat_count(lv.ANIM_REPEAT.INFINITE) 47 a_col.set_time(500) 48 a_col.set_playback_time(500) 49 a_col. set_custom_exec_cb(lambda a,val: column_gap_anim(cont,val)) 50 lv.anim_t.start(a_col) 51 52