lv_example_style_1.py 412 B

12345678910111213141516171819202122232425
  1. #
  2. # Using the Size, Position and Padding style properties
  3. #
  4. style = lv.style_t()
  5. style.init()
  6. style.set_radius(5)
  7. # Make a gradient
  8. style.set_width(150)
  9. style.set_height(lv.SIZE.CONTENT)
  10. style.set_pad_ver(20)
  11. style.set_pad_left(5)
  12. style.set_x(lv.pct(50))
  13. style.set_y(80)
  14. # Create an object with the new style
  15. obj = lv.obj(lv.scr_act())
  16. obj.add_style(style, 0)
  17. label = lv.label(obj)
  18. label.set_text("Hello")