feat(examples) add MicroPython version of lv_example_anim_3 and allow loading roller font dynamically (#2412)

This commit is contained in:
Uli Raich
2021-07-28 14:51:41 +02:00
committed by GitHub
parent 4dd1d566fc
commit 06b3013de5
3 changed files with 136 additions and 5 deletions

View File

@@ -1,8 +1,5 @@
#!/opt/bin/lv_micropython -i
import utime as time
import lvgl as lv
import display_driver
import usys as sys
import fs_driver
import sys
class Lv_Roller_3():
@@ -29,6 +26,15 @@ class Lv_Roller_3():
#if LV_FONT_MONTSERRAT_22
# lv_obj_set_style_text_font(roller1, &lv_font_montserrat_22, LV_PART_SELECTED);
#endif
try:
roller1.set_style_text_font(lv.font_montserrat_22,lv.PART.SELECTED)
except:
fs_drv = lv.fs_drv_t()
fs_driver.fs_register(fs_drv, 'S')
print("montserrat-22 not enabled in lv_conf.h, dynamically loading the font")
font_montserrat_22 = lv.font_load("S:" + "../../assets/font/montserrat-22.fnt")
roller1.set_style_text_font(font_montserrat_22,lv.PART.SELECTED)
roller1.set_options("\n".join([
"January",
"February",