1#
2# Demonstrate RTL direction on grid
3#
4col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST]
5row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST]
6
7# Create a container with grid
8cont = lv.obj(lv.scr_act())
9cont.set_size(300, 220)
10cont.center()
11cont.set_style_base_dir(lv.BASE_DIR.RTL,0)
12cont.set_grid_dsc_array(col_dsc, row_dsc)
13
14for 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
28