lv_label1.py 924 B

123456789101112131415161718192021222324252627
  1. #!pika
  2. import pika_lvgl as lv
  3. import PikaStdLib
  4. mem = PikaStdLib.MemChecker()
  5. label1 = lv.label(lv.scr_act())
  6. LV_LABEL_LONG_WRAP = 0
  7. label1.set_long_mode(LV_LABEL_LONG_WRAP) # Break the long lines*/
  8. # Enable re-coloring by commands in the text
  9. label1.set_recolor(True)
  10. label1.set_text("#0000ff Re-color# #ff00ff words# #ff0000 of a# label, \
  11. align the lines to the center and wrap long text automatically.")
  12. # Set smaller width to make the lines wrap
  13. label1.set_width(150)
  14. label1.set_style_text_align(lv.ALIGN.CENTER, 0)
  15. label1.align(lv.ALIGN.CENTER, 0, -40)
  16. LV_LABEL_LONG_SCROLL_CIRCULAR = 3
  17. label2 = lv.label(lv.scr_act())
  18. label2.set_long_mode(LV_LABEL_LONG_SCROLL_CIRCULAR) # Circular scroll
  19. label2.set_width(150)
  20. label2.set_text("It is a circularly scrolling text. ")
  21. label2.align(lv.ALIGN.CENTER, 0, 40)
  22. print('mem used max: %0.2f kB' % (mem.getMax()))
  23. print('mem used now: %0.2f kB' % (mem.getNow()))
  24. #!pika