lv_example_style_4.py 453 B

12345678910111213141516171819202122
  1. #
  2. # Using the outline style properties
  3. #
  4. style = lv.style_t()
  5. style.init()
  6. # Set a background color and a radius
  7. style.set_radius(5)
  8. style.set_bg_opa(lv.OPA.COVER)
  9. style.set_bg_color(lv.palette_lighten(lv.PALETTE.GREY, 1))
  10. # Add outline
  11. style.set_outline_width(2)
  12. style.set_outline_color(lv.palette_main(lv.PALETTE.BLUE))
  13. style.set_outline_pad(8)
  14. # Create an object with the new style
  15. obj = lv.obj(lv.scr_act())
  16. obj.add_style(style, 0)
  17. obj.center()