@@ -1,5 +0,0 @@
|
||||
bar1 = lv.bar(lv.screen_active())
|
||||
bar1.set_size(200, 20)
|
||||
bar1.center()
|
||||
bar1.set_value(70, lv.ANIM.OFF)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# Example of styling the bar
|
||||
#
|
||||
style_bg = lv.style_t()
|
||||
style_indic = lv.style_t()
|
||||
|
||||
style_bg.init()
|
||||
style_bg.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
|
||||
style_bg.set_border_width(2)
|
||||
style_bg.set_pad_all(6) # To make the indicator smaller
|
||||
style_bg.set_radius(6)
|
||||
style_bg.set_anim_time(1000)
|
||||
|
||||
style_indic.init()
|
||||
style_indic.set_bg_opa(lv.OPA.COVER)
|
||||
style_indic.set_bg_color(lv.palette_main(lv.PALETTE.BLUE))
|
||||
style_indic.set_radius(3)
|
||||
|
||||
bar = lv.bar(lv.screen_active())
|
||||
bar.remove_style_all() # To have a clean start
|
||||
bar.add_style(style_bg, 0)
|
||||
bar.add_style(style_indic, lv.PART.INDICATOR)
|
||||
|
||||
bar.set_size(200, 20)
|
||||
bar.center()
|
||||
bar.set_value(100, lv.ANIM.ON)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
def set_temp(bar, temp):
|
||||
bar.set_value(temp, lv.ANIM.ON)
|
||||
|
||||
#
|
||||
# A temperature meter example
|
||||
#
|
||||
|
||||
|
||||
style_indic = lv.style_t()
|
||||
|
||||
style_indic.init()
|
||||
style_indic.set_bg_opa(lv.OPA.COVER)
|
||||
style_indic.set_bg_color(lv.palette_main(lv.PALETTE.RED))
|
||||
style_indic.set_bg_grad_color(lv.palette_main(lv.PALETTE.BLUE))
|
||||
style_indic.set_bg_grad_dir(lv.GRAD_DIR.VER)
|
||||
|
||||
bar = lv.bar(lv.screen_active())
|
||||
bar.add_style(style_indic, lv.PART.INDICATOR)
|
||||
bar.set_size(20, 200)
|
||||
bar.center()
|
||||
bar.set_range(-20, 40)
|
||||
|
||||
a = lv.anim_t()
|
||||
a.init()
|
||||
a.set_time(3000)
|
||||
a.set_playback_duration(3000)
|
||||
a.set_var(bar)
|
||||
a.set_values(-20, 40)
|
||||
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a.set_custom_exec_cb(lambda a, val: set_temp(bar,val))
|
||||
lv.anim_t.start(a)
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Create an image from the png file
|
||||
try:
|
||||
with open('../../assets/img_strip.png','rb') as f:
|
||||
png_data = f.read()
|
||||
except:
|
||||
print("Could not find img_strip.png")
|
||||
sys.exit()
|
||||
|
||||
image_skew_strip_dsc = lv.image_dsc_t({
|
||||
'data_size': len(png_data),
|
||||
'data': png_data
|
||||
})
|
||||
|
||||
#
|
||||
# Bar with stripe pattern and ranged value
|
||||
#
|
||||
|
||||
style_indic = lv.style_t()
|
||||
|
||||
style_indic.init()
|
||||
style_indic.set_bg_image_src(image_skew_strip_dsc)
|
||||
style_indic.set_bg_image_tiled(True)
|
||||
style_indic.set_bg_image_opa(lv.OPA._30)
|
||||
|
||||
bar = lv.bar(lv.screen_active())
|
||||
bar.add_style(style_indic, lv.PART.INDICATOR)
|
||||
|
||||
bar.set_size(260, 20)
|
||||
bar.center()
|
||||
bar.set_mode(lv.bar.MODE.RANGE)
|
||||
bar.set_value(90, lv.ANIM.OFF)
|
||||
bar.set_start_value(20, lv.ANIM.OFF)
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Bar with LTR and RTL base direction
|
||||
#
|
||||
|
||||
bar_ltr = lv.bar(lv.screen_active())
|
||||
bar_ltr.set_size(200, 20)
|
||||
bar_ltr.set_value(70, lv.ANIM.OFF)
|
||||
bar_ltr.align(lv.ALIGN.CENTER, 0, -30)
|
||||
|
||||
label = lv.label(lv.screen_active())
|
||||
label.set_text("Left to Right base direction")
|
||||
label.align_to(bar_ltr, lv.ALIGN.OUT_TOP_MID, 0, -5)
|
||||
|
||||
bar_rtl = lv.bar(lv.screen_active())
|
||||
bar_rtl.set_style_base_dir(lv.BASE_DIR.RTL,0)
|
||||
bar_rtl.set_size(200, 20)
|
||||
bar_rtl.set_value(70, lv.ANIM.OFF)
|
||||
bar_rtl.align(lv.ALIGN.CENTER, 0, 30)
|
||||
|
||||
label = lv.label(lv.screen_active())
|
||||
label.set_text("Right to Left base direction")
|
||||
label.align_to(bar_rtl, lv.ALIGN.OUT_TOP_MID, 0, -5)
|
||||
@@ -1 +0,0 @@
|
||||
pass
|
||||
@@ -1 +0,0 @@
|
||||
pass
|
||||
Reference in New Issue
Block a user