lv_example_style_8.py 608 B

12345678910111213141516171819202122232425262728
  1. #
  2. # Using the text style properties
  3. #
  4. style = lv.style_t()
  5. style.init()
  6. style.set_radius(5)
  7. style.set_bg_opa(lv.OPA.COVER)
  8. style.set_bg_color(lv.palette_lighten(lv.PALETTE.GREY, 3))
  9. style.set_border_width(2)
  10. style.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
  11. style.set_pad_all(10)
  12. style.set_text_color(lv.palette_main(lv.PALETTE.BLUE))
  13. style.set_text_letter_space(5)
  14. style.set_text_line_space(20)
  15. style.set_text_decor(lv.TEXT_DECOR.UNDERLINE)
  16. # Create an object with the new style
  17. obj = lv.label(lv.scr_act())
  18. obj.add_style(style, 0)
  19. obj.set_text("Text of\n"
  20. "a label")
  21. obj.center()