1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(examples) adjust constant names in Micropython examples (#3532)

Due to spurious enums (https://github.com/lvgl/lv_binding_micropython/issues/199) wrong constant names were generated. Fix these constants.
This commit is contained in:
Amir Gonnen 2022-07-30 18:10:56 +03:00 committed by GitHub
parent 2461ac0758
commit 7a23be73ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 64 additions and 64 deletions

View File

@ -10,7 +10,7 @@ def anim_size_cb(obj, v):
# #
obj = lv.obj(lv.scr_act()) obj = lv.obj(lv.scr_act())
obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), 0) obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), 0)
obj.set_style_radius(lv.RADIUS.CIRCLE, 0) obj.set_style_radius(lv.RADIUS_CIRCLE, 0)
obj.align(lv.ALIGN.LEFT_MID, 10, 0) obj.align(lv.ALIGN.LEFT_MID, 10, 0)
@ -22,7 +22,7 @@ a1.set_time(1000)
a1.set_playback_delay(100) a1.set_playback_delay(100)
a1.set_playback_time(300) a1.set_playback_time(300)
a1.set_repeat_delay(500) a1.set_repeat_delay(500)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a1.set_path_cb(lv.anim_t.path_ease_in_out) a1.set_path_cb(lv.anim_t.path_ease_in_out)
a1.set_custom_exec_cb(lambda a1,val: anim_size_cb(obj,val)) a1.set_custom_exec_cb(lambda a1,val: anim_size_cb(obj,val))
lv.anim_t.start(a1) lv.anim_t.start(a1)
@ -35,7 +35,7 @@ a2.set_time(1000)
a2.set_playback_delay(100) a2.set_playback_delay(100)
a2.set_playback_time(300) a2.set_playback_time(300)
a2.set_repeat_delay(500) a2.set_repeat_delay(500)
a2.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a2.set_path_cb(lv.anim_t.path_ease_in_out) a2.set_path_cb(lv.anim_t.path_ease_in_out)
a2.set_custom_exec_cb(lambda a1,val: anim_x_cb(obj,val)) a2.set_custom_exec_cb(lambda a1,val: anim_x_cb(obj,val))
lv.anim_t.start(a2) lv.anim_t.start(a2)

View File

@ -14,8 +14,8 @@ class LvExampleAnim_3():
# #
def __init__(self): def __init__(self):
# Create a container with grid # Create a container with grid
col_dsc = [lv.grid_fr(1), 200, lv.grid_fr(1), lv.GRID_TEMPLATE.LAST] col_dsc = [lv.grid_fr(1), 200, lv.grid_fr(1), lv.GRID_TEMPLATE_LAST]
row_dsc = [30, 10, 10, lv.grid_fr(1),lv.GRID_TEMPLATE.LAST] row_dsc = [30, 10, 10, lv.grid_fr(1),lv.GRID_TEMPLATE_LAST]
self.p1 = 0 self.p1 = 0
self.p2 = 0 self.p2 = 0

View File

@ -54,7 +54,7 @@ btn2.set_size(120, 50) # Set its size
btn2.add_style(style_btn, 0) btn2.add_style(style_btn, 0)
btn2.add_style(style_btn_red, 0) btn2.add_style(style_btn_red, 0)
btn2.add_style(style_btn_pressed, lv.STATE.PRESSED) btn2.add_style(style_btn_pressed, lv.STATE.PRESSED)
btn2.set_style_radius(lv.RADIUS.CIRCLE, 0) # Add a local style btn2.set_style_radius(lv.RADIUS_CIRCLE, 0) # Add a local style
label = lv.label(btn2) # Add a label to the button label = lv.label(btn2) # Add a label to the button
label.set_text("Button 2") # Set the labels text label.set_text("Button 2") # Set the labels text

View File

@ -25,7 +25,7 @@ for i in range(10):
# Add items to the column # Add items to the column
obj = lv.btn(cont_col) obj = lv.btn(cont_col)
obj.set_size(lv.pct(100), lv.SIZE.CONTENT) obj.set_size(lv.pct(100), lv.SIZE_CONTENT)
label = lv.label(obj) label = lv.label(obj)
label.set_text("Item: {:d}".format(i)) label.set_text("Item: {:d}".format(i))

View File

@ -14,7 +14,7 @@ cont.add_style(style, 0)
for i in range(8): for i in range(8):
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(70, lv.SIZE.CONTENT) obj.set_size(70, lv.SIZE_CONTENT)
label = lv.label(obj) label = lv.label(obj)
label.set_text("{:d}".format(i)) label.set_text("{:d}".format(i))

View File

@ -16,7 +16,7 @@ cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
for i in range(9): for i in range(9):
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(70, lv.SIZE.CONTENT) obj.set_size(70, lv.SIZE_CONTENT)
label = lv.label(obj) label = lv.label(obj)
label.set_text(str(i)) label.set_text(str(i))
@ -26,7 +26,7 @@ a_row = lv.anim_t()
a_row.init() a_row.init()
a_row.set_var(cont) a_row.set_var(cont)
a_row.set_values(0, 10) a_row.set_values(0, 10)
a_row.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a_row.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a_row.set_time(500) a_row.set_time(500)
a_row.set_playback_time(500) a_row.set_playback_time(500)
@ -37,7 +37,7 @@ a_col = lv.anim_t()
a_col.init() a_col.init()
a_col.set_var(cont) a_col.set_var(cont)
a_col.set_values(0, 10) a_col.set_values(0, 10)
a_col.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a_col.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a_col.set_time(3000) a_col.set_time(3000)
a_col.set_playback_time(3000) a_col.set_playback_time(3000)

View File

@ -11,7 +11,7 @@ cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
for i in range(20): for i in range(20):
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(70, lv.SIZE.CONTENT) obj.set_size(70, lv.SIZE_CONTENT)
label = lv.label(obj) label = lv.label(obj)
label.set_text(str(i)) label.set_text(str(i))

View File

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

View File

@ -2,8 +2,8 @@
# Demonstrate cell placement and span # Demonstrate cell placement and span
# #
col_dsc = [70, 70, 70, lv.GRID_TEMPLATE.LAST] col_dsc = [70, 70, 70, lv.GRID_TEMPLATE_LAST]
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE.LAST] row_dsc = [50, 50, 50, lv.GRID_TEMPLATE_LAST]
# Create a container with grid # Create a container with grid
cont = lv.obj(lv.scr_act()) cont = lv.obj(lv.scr_act())
@ -13,7 +13,7 @@ cont.center()
# Cell to 0;0 and align to the start (left/top) horizontally and vertically too # Cell to 0;0 and align to the start (left/top) horizontally and vertically too
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) obj.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1, obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,
lv.GRID_ALIGN.START, 0, 1) lv.GRID_ALIGN.START, 0, 1)
label = lv.label(obj) label = lv.label(obj)
@ -21,7 +21,7 @@ label.set_text("c0, r0")
# Cell to 1;0 and align to the start (left) horizontally and center vertically too # Cell to 1;0 and align to the start (left) horizontally and center vertically too
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) obj.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
obj.set_grid_cell(lv.GRID_ALIGN.START, 1, 1, obj.set_grid_cell(lv.GRID_ALIGN.START, 1, 1,
lv.GRID_ALIGN.CENTER, 0, 1) lv.GRID_ALIGN.CENTER, 0, 1)
label = lv.label(obj) label = lv.label(obj)
@ -29,7 +29,7 @@ label.set_text("c1, r0")
# Cell to 2;0 and align to the start (left) horizontally and end (bottom) vertically too # Cell to 2;0 and align to the start (left) horizontally and end (bottom) vertically too
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) obj.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
obj.set_grid_cell(lv.GRID_ALIGN.START, 2, 1, obj.set_grid_cell(lv.GRID_ALIGN.START, 2, 1,
lv.GRID_ALIGN.END, 0, 1) lv.GRID_ALIGN.END, 0, 1)
label = lv.label(obj) label = lv.label(obj)
@ -37,7 +37,7 @@ label.set_text("c2, r0")
# Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched. # Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) obj.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 1, 2, obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 1, 2,
lv.GRID_ALIGN.STRETCH, 1, 1) lv.GRID_ALIGN.STRETCH, 1, 1)
label = lv.label(obj) label = lv.label(obj)
@ -45,7 +45,7 @@ label.set_text("c1-2, r1")
# Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched. # Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.
obj = lv.obj(cont) obj = lv.obj(cont)
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) obj.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 0, 1, obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 0, 1,
lv.GRID_ALIGN.STRETCH, 1, 2) lv.GRID_ALIGN.STRETCH, 1, 2)
label = lv.label(obj) label = lv.label(obj)

View File

@ -6,13 +6,13 @@
# Column 2: 1 unit from the remaining free space # Column 2: 1 unit from the remaining free space
# Column 3: 2 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.GRID_TEMPLATE.LAST] col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE_LAST]
# Row 1: fix width 60 px # Row 1: fix width 60 px
# Row 2: 1 unit from the remaining free space # Row 2: 1 unit from the remaining free space
# Row 3: fix width 60 px # Row 3: fix width 60 px
row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE.LAST] row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid # Create a container with grid
cont = lv.obj(lv.scr_act()) cont = lv.obj(lv.scr_act())

View File

@ -2,8 +2,8 @@
# Demonstrate track placement # Demonstrate track placement
# #
col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST] row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Add space between the columns and move the rows to the bottom (end) # Add space between the columns and move the rows to the bottom (end)

View File

@ -9,8 +9,8 @@ def column_gap_anim(obj, v):
# #
# 60x60 cells # 60x60 cells
col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST] row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid # Create a container with grid
cont = lv.obj(lv.scr_act()) cont = lv.obj(lv.scr_act())
@ -33,7 +33,7 @@ for i in range(9):
a_row.init() a_row.init()
a_row.set_var(cont) a_row.set_var(cont)
a_row.set_values(0, 10) a_row.set_values(0, 10)
a_row.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a_row.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a_row.set_time(500) a_row.set_time(500)
a_row.set_playback_time(500) a_row.set_playback_time(500)
a_row. set_custom_exec_cb(lambda a,val: row_gap_anim(cont,val)) a_row. set_custom_exec_cb(lambda a,val: row_gap_anim(cont,val))
@ -43,7 +43,7 @@ for i in range(9):
a_col.init() a_col.init()
a_col.set_var(cont) a_col.set_var(cont)
a_col.set_values(0, 10) a_col.set_values(0, 10)
a_col.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a_col.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a_col.set_time(500) a_col.set_time(500)
a_col.set_playback_time(500) a_col.set_playback_time(500)
a_col. set_custom_exec_cb(lambda a,val: column_gap_anim(cont,val)) a_col. set_custom_exec_cb(lambda a,val: column_gap_anim(cont,val))

View File

@ -1,8 +1,8 @@
# #
# Demonstrate RTL direction on grid # Demonstrate RTL direction on grid
# #
col_dsc = [60, 60, 60, lv.GRID_TEMPLATE.LAST] col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE.LAST] row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid # Create a container with grid
cont = lv.obj(lv.scr_act()) cont = lv.obj(lv.scr_act())

View File

@ -17,7 +17,7 @@ class ScrollExample_3():
float_btn.add_flag(lv.obj.FLAG.FLOATING) float_btn.add_flag(lv.obj.FLAG.FLOATING)
float_btn.align(lv.ALIGN.BOTTOM_RIGHT, 0, -list.get_style_pad_right(lv.PART.MAIN)) float_btn.align(lv.ALIGN.BOTTOM_RIGHT, 0, -list.get_style_pad_right(lv.PART.MAIN))
float_btn.add_event_cb(lambda evt: self.float_btn_event_cb(evt,list), lv.EVENT.ALL, None) float_btn.add_event_cb(lambda evt: self.float_btn_event_cb(evt,list), lv.EVENT.ALL, None)
float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0) float_btn.set_style_radius(lv.RADIUS_CIRCLE, 0)
float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0) float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0)
float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0) float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0)

View File

@ -47,7 +47,7 @@ cont.set_size(200, 200)
cont.center() cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.COLUMN) cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
cont.add_event_cb(scroll_event_cb, lv.EVENT.SCROLL, None) cont.add_event_cb(scroll_event_cb, lv.EVENT.SCROLL, None)
cont.set_style_radius(lv.RADIUS.CIRCLE, 0) cont.set_style_radius(lv.RADIUS_CIRCLE, 0)
cont.set_style_clip_corner(True, 0) cont.set_style_clip_corner(True, 0)
cont.set_scroll_dir(lv.DIR.VER) cont.set_scroll_dir(lv.DIR.VER)
cont.set_scroll_snap_y(lv.SCROLL_SNAP.CENTER) cont.set_scroll_snap_y(lv.SCROLL_SNAP.CENTER)

View File

@ -7,7 +7,7 @@ style.set_radius(5)
# Make a gradient # Make a gradient
style.set_width(150) style.set_width(150)
style.set_height(lv.SIZE.CONTENT) style.set_height(lv.SIZE_CONTENT)
style.set_pad_ver(20) style.set_pad_ver(20)
style.set_pad_left(5) style.set_pad_left(5)

View File

@ -14,7 +14,7 @@ style_base.set_shadow_ofs_y(5)
style_base.set_shadow_opa(lv.OPA._50) style_base.set_shadow_opa(lv.OPA._50)
style_base.set_text_color(lv.color_white()) style_base.set_text_color(lv.color_white())
style_base.set_width(100) style_base.set_width(100)
style_base.set_height(lv.SIZE.CONTENT) style_base.set_height(lv.SIZE_CONTENT)
# Set only the properties that should be different # Set only the properties that should be different
style_warning = lv.style_t() style_warning = lv.style_t()

View File

@ -47,7 +47,7 @@ animimg0 = lv.animimg(lv.scr_act())
animimg0.center() animimg0.center()
animimg0.set_src(anim_imgs, 3) animimg0.set_src(anim_imgs, 3)
animimg0.set_duration(1000) animimg0.set_duration(1000)
animimg0.set_repeat_count(lv.ANIM_REPEAT.INFINITE) animimg0.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
animimg0.start() animimg0.start()

View File

@ -26,7 +26,7 @@ a.set_time(3000)
a.set_playback_time(3000) a.set_playback_time(3000)
a.set_var(bar) a.set_var(bar)
a.set_values(-20, 40) a.set_values(-20, 40)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a, val: set_temp(bar,val)) a.set_custom_exec_cb(lambda a, val: set_temp(bar,val))
lv.anim_t.start(a) lv.anim_t.start(a)

View File

@ -49,6 +49,6 @@ a.set_values(0, 100)
a.set_custom_exec_cb(lambda a,val: set_value(bar,val)) a.set_custom_exec_cb(lambda a,val: set_value(bar,val))
a.set_time(2000) a.set_time(2000)
a.set_playback_time(2000) a.set_playback_time(2000)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a) lv.anim_t.start(a)

View File

@ -52,6 +52,6 @@ a.set_values(0, 100)
a.set_custom_exec_cb(lambda a,val: set_value(bar,val)) a.set_custom_exec_cb(lambda a,val: set_value(bar,val))
a.set_time(2000) a.set_time(2000)
a.set_playback_time(2000) a.set_playback_time(2000)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a) lv.anim_t.start(a)

View File

@ -25,7 +25,7 @@ btn2.add_event_cb(event_handler,lv.EVENT.ALL, None)
btn2.align(lv.ALIGN.CENTER,0,40) btn2.align(lv.ALIGN.CENTER,0,40)
btn2.add_flag(lv.obj.FLAG.CHECKABLE) btn2.add_flag(lv.obj.FLAG.CHECKABLE)
btn2.set_height(lv.SIZE.CONTENT) btn2.set_height(lv.SIZE_CONTENT)
label=lv.label(btn2) label=lv.label(btn2)
label.set_text("Toggle") label.set_text("Toggle")

View File

@ -51,7 +51,7 @@ btn1 = lv.btn(lv.scr_act())
btn1.remove_style_all() # Remove the style coming from the theme btn1.remove_style_all() # Remove the style coming from the theme
btn1.add_style(style, 0) btn1.add_style(style, 0)
btn1.add_style(style_pr, lv.STATE.PRESSED) btn1.add_style(style_pr, lv.STATE.PRESSED)
btn1.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) btn1.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
btn1.center() btn1.center()
label = lv.label(btn1) label = lv.label(btn1)

View File

@ -39,7 +39,7 @@ def event_cb(e):
# Change the draw descriptor the 3rd button # Change the draw descriptor the 3rd button
elif dsc.id == 2: elif dsc.id == 2:
dsc.rect_dsc.radius = lv.RADIUS.CIRCLE dsc.rect_dsc.radius = lv.RADIUS_CIRCLE
if obj.get_selected_btn() == dsc.id: if obj.get_selected_btn() == dsc.id:
dsc.rect_dsc.bg_color = lv.palette_darken(lv.PALETTE.RED, 3) dsc.rect_dsc.bg_color = lv.palette_darken(lv.PALETTE.RED, 3)
else: else:

View File

@ -30,7 +30,7 @@ style_bg.init()
style_bg.set_pad_all(0) style_bg.set_pad_all(0)
style_bg.set_pad_gap(0) style_bg.set_pad_gap(0)
style_bg.set_clip_corner(True) style_bg.set_clip_corner(True)
style_bg.set_radius(lv.RADIUS.CIRCLE) style_bg.set_radius(lv.RADIUS_CIRCLE)
style_bg.set_border_width(0) style_bg.set_border_width(0)

View File

@ -10,7 +10,7 @@ def event_cb(e):
elif code == lv.EVENT.DRAW_POST_END: elif code == lv.EVENT.DRAW_POST_END:
id = lv.chart.get_pressed_point(chart) id = lv.chart.get_pressed_point(chart)
if id == lv.CHART_POINT.NONE: if id == lv.CHART_POINT_NONE:
return return
# print("Selected point ", id) # print("Selected point ", id)
for i in range(len(series)): for i in range(len(series)):

View File

@ -76,13 +76,13 @@ chart.set_point_count(pcnt)
chart.set_ext_y_array(ser, ecg_sample) chart.set_ext_y_array(ser, ecg_sample)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM.NONE, lv.IMG_ZOOM.NONE * 10) slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10)
slider.add_event_cb(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event_cb(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(200,10) slider.set_size(200,10)
slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20) slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM.NONE, lv.IMG_ZOOM.NONE * 10) slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10)
slider.add_event_cb(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event_cb(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(10, 150) slider.set_size(10, 150)
slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0) slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0)

View File

@ -42,7 +42,7 @@ class ExampleChart_6():
if code == lv.EVENT.VALUE_CHANGED: if code == lv.EVENT.VALUE_CHANGED:
# print("last_id: ",self.last_id) # print("last_id: ",self.last_id)
self.last_id = chart.get_pressed_point() self.last_id = chart.get_pressed_point()
if self.last_id != lv.CHART_POINT.NONE: if self.last_id != lv.CHART_POINT_NONE:
p = lv.point_t() p = lv.point_t()
chart.get_point_pos_by_id(self.ser, self.last_id, p) chart.get_point_pos_by_id(self.ser, self.last_id, p)
chart.set_cursor_point(self.cursor, None, self.last_id) chart.set_cursor_point(self.cursor, None, self.last_id)

View File

@ -8,9 +8,9 @@ def add_data(t):
s = chart.get_x_start_point(ser) s = chart.get_x_start_point(ser)
a = chart.get_y_array(ser) a = chart.get_y_array(ser)
a[(s + 1) % p] = lv.CHART_POINT.NONE a[(s + 1) % p] = lv.CHART_POINT_NONE
a[(s + 2) % p] = lv.CHART_POINT.NONE a[(s + 2) % p] = lv.CHART_POINT_NONE
a[(s + 3) % p] = lv.CHART_POINT.NONE a[(s + 3) % p] = lv.CHART_POINT_NONE
chart.refresh() chart.refresh()
# #

View File

@ -45,7 +45,7 @@ a1.set_var(img)
a1.set_custom_exec_cb(lambda a,val: set_angle(img,val)) a1.set_custom_exec_cb(lambda a,val: set_angle(img,val))
a1.set_values(0, 3600) a1.set_values(0, 3600)
a1.set_time(5000) a1.set_time(5000)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a1) lv.anim_t.start(a1)
a2 = lv.anim_t() a2 = lv.anim_t()
@ -55,7 +55,7 @@ a2.set_custom_exec_cb(lambda a,val: set_zoom(img,val))
a2.set_values(128, 256) a2.set_values(128, 256)
a2.set_time(5000) a2.set_time(5000)
a2.set_playback_time(3000) a2.set_playback_time(3000)
a2.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a2) lv.anim_t.start(a2)

View File

@ -45,7 +45,7 @@ a.set_var(img)
a.set_values(0, 100) a.set_values(0, 100)
a.set_time(3000) a.set_time(3000)
a.set_playback_time(500) a.set_playback_time(500)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a,val: ofs_y_anim(img,val)) a.set_custom_exec_cb(lambda a,val: ofs_y_anim(img,val))
lv.anim_t.start(a) lv.anim_t.start(a)

View File

@ -42,6 +42,6 @@ float_btn.set_size(50, 50)
float_btn.add_flag(lv.obj.FLAG.FLOATING) float_btn.add_flag(lv.obj.FLAG.FLOATING)
float_btn.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10) float_btn.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10)
float_btn.add_event_cb(float_btn_event_cb, lv.EVENT.CLICKED, None) float_btn.add_event_cb(float_btn_event_cb, lv.EVENT.CLICKED, None)
float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0) float_btn.set_style_radius(lv.RADIUS_CIRCLE, 0)
float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0) float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0)
float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0) float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0)

View File

@ -52,7 +52,7 @@ a.set_time(2000)
a.set_repeat_delay(100) a.set_repeat_delay(100)
a.set_playback_time(500) a.set_playback_time(500)
a.set_playback_delay(100) a.set_playback_delay(100)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a,val: set_value(indic,val)) a.set_custom_exec_cb(lambda a,val: set_value(indic,val))
lv.anim_t.start(a) lv.anim_t.start(a)

View File

@ -37,7 +37,7 @@ a1.set_repeat_delay(100)
a1.set_playback_delay(100) a1.set_playback_delay(100)
a1.set_playback_time(500) a1.set_playback_time(500)
a1.set_var(indic1) a1.set_var(indic1)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a1.set_custom_exec_cb(lambda a,val: set_value(indic1,val)) a1.set_custom_exec_cb(lambda a,val: set_value(indic1,val))
lv.anim_t.start(a1) lv.anim_t.start(a1)
@ -49,7 +49,7 @@ a2.set_repeat_delay(100)
a2.set_playback_delay(100) a2.set_playback_delay(100)
a2.set_playback_time(1000) a2.set_playback_time(1000)
a2.set_var(indic2) a2.set_var(indic2)
a2.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a2.set_custom_exec_cb(lambda a,val: set_value(indic2,val)) a2.set_custom_exec_cb(lambda a,val: set_value(indic2,val))
lv.anim_t.start(a2) lv.anim_t.start(a2)
@ -61,7 +61,7 @@ a3.set_repeat_delay(100)
a3.set_playback_delay(100) a3.set_playback_delay(100)
a3.set_playback_time(2000) a3.set_playback_time(2000)
a3.set_var(indic3) a3.set_var(indic3)
a3.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a3.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a3.set_custom_exec_cb(lambda a,val: set_value(indic3,val)) a3.set_custom_exec_cb(lambda a,val: set_value(indic3,val))
lv.anim_t.start(a3) lv.anim_t.start(a3)

View File

@ -67,7 +67,7 @@ indic_hour = meter.add_needle_img(scale_min, img_hand_hour_dsc, 5, 5)
a1 = lv.anim_t() a1 = lv.anim_t()
a1.init() a1.init()
a1.set_values(0, 60) a1.set_values(0, 60)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE) a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a1.set_time(2000) # 2 sec for 1 turn of the minute hand (1 hour) a1.set_time(2000) # 2 sec for 1 turn of the minute hand (1 hour)
a1.set_var(indic_min) a1.set_var(indic_min)
a1.set_custom_exec_cb(lambda a1,val: set_value(indic_min,val)) a1.set_custom_exec_cb(lambda a1,val: set_value(indic_min,val))

View File

@ -13,13 +13,13 @@ style_pressed_color = lv.style_t()
style_main.init() style_main.init()
style_main.set_bg_opa(lv.OPA.COVER) style_main.set_bg_opa(lv.OPA.COVER)
style_main.set_bg_color(lv.color_hex3(0xbbb)) style_main.set_bg_color(lv.color_hex3(0xbbb))
style_main.set_radius(lv.RADIUS.CIRCLE) style_main.set_radius(lv.RADIUS_CIRCLE)
style_main.set_pad_ver(-2) # Makes the indicator larger style_main.set_pad_ver(-2) # Makes the indicator larger
style_indicator.init() style_indicator.init()
style_indicator.set_bg_opa(lv.OPA.COVER) style_indicator.set_bg_opa(lv.OPA.COVER)
style_indicator.set_bg_color(lv.palette_main(lv.PALETTE.CYAN)) style_indicator.set_bg_color(lv.palette_main(lv.PALETTE.CYAN))
style_indicator.set_radius(lv.RADIUS.CIRCLE) style_indicator.set_radius(lv.RADIUS_CIRCLE)
style_indicator.set_transition(transition_dsc) style_indicator.set_transition(transition_dsc)
style_knob.init() style_knob.init()
@ -27,7 +27,7 @@ style_knob.set_bg_opa(lv.OPA.COVER)
style_knob.set_bg_color(lv.palette_main(lv.PALETTE.CYAN)) style_knob.set_bg_color(lv.palette_main(lv.PALETTE.CYAN))
style_knob.set_border_color(lv.palette_darken(lv.PALETTE.CYAN, 3)) style_knob.set_border_color(lv.palette_darken(lv.PALETTE.CYAN, 3))
style_knob.set_border_width(2) style_knob.set_border_width(2)
style_knob.set_radius(lv.RADIUS.CIRCLE) style_knob.set_radius(lv.RADIUS_CIRCLE)
style_knob.set_pad_all(6) # Makes the knob larger style_knob.set_pad_all(6) # Makes the knob larger
style_knob.set_transition(transition_dsc) style_knob.set_transition(transition_dsc)

View File

@ -18,7 +18,7 @@ def draw_event_cb(e):
else: else:
rect_dsc.bg_color = lv.palette_lighten(lv.PALETTE.GREY, 2) rect_dsc.bg_color = lv.palette_lighten(lv.PALETTE.GREY, 2)
rect_dsc.radius = lv.RADIUS.CIRCLE rect_dsc.radius = lv.RADIUS_CIRCLE
sw_area = lv.area_t() sw_area = lv.area_t()
sw_area.x1 = dsc.draw_area.x2 - 50 sw_area.x1 = dsc.draw_area.x2 - 50

View File

@ -19,7 +19,7 @@ btn = lv.btn(tile2)
label = lv.label(btn) label = lv.label(btn)
label.set_text("Scroll up or right") label.set_text("Scroll up or right")
btn.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT) btn.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
btn.center() btn.center()
# Tile3: a list # Tile3: a list