fix(examples) use lv.grid_fr for MicroPython (#2419)

Instead of re-implementing LV_GRID_FR, use lv.grid_fr

Also use lv.GRID_TEMPLATE.LAST instead of lv.COORD.MAX where needed
This commit is contained in:
Amir Gonnen
2021-07-31 16:07:07 +03:00
committed by GitHub
parent 65475a75ba
commit 145440dbce
3 changed files with 6 additions and 10 deletions

View File

@@ -2,8 +2,8 @@
# A simple grid
#
col_dsc = [70, 70, 70, lv.COORD.MAX]
row_dsc = [50, 50, 50, lv.COORD.MAX]
col_dsc = [70, 70, 70, lv.GRID_TEMPLATE.LAST]
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE.LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())

View File

@@ -1,5 +1,3 @@
def LV_GRID_FR(x):
return lv.COORD.MAX - 100 + x
#
# Demonstrate grid's "free unit"
#
@@ -8,13 +6,13 @@ def LV_GRID_FR(x):
# Column 2: 1 unit from the remaining free space
# Column 3: 2 unit from the remaining free space
col_dsc = [60, LV_GRID_FR(1), LV_GRID_FR(2), lv.COORD.MAX]
col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE.LAST]
# Row 1: fix width 60 px
# Row 2: 1 unit from the remaining free space
# Row 3: fix width 60 px
row_dsc = [40, LV_GRID_FR(1), 40, lv.COORD.MAX]
row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE.LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())