acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_style_11.py (1315B)
1 # 2 # Using multiple styles 3 # 4 # A base style 5 6 style_base = lv.style_t() 7 style_base.init() 8 style_base.set_bg_color(lv.palette_main(lv.PALETTE.LIGHT_BLUE)) 9 style_base.set_border_color(lv.palette_darken(lv.PALETTE.LIGHT_BLUE, 3)) 10 style_base.set_border_width(2) 11 style_base.set_radius(10) 12 style_base.set_shadow_width(10) 13 style_base.set_shadow_ofs_y(5) 14 style_base.set_shadow_opa(lv.OPA._50) 15 style_base.set_text_color(lv.color_white()) 16 style_base.set_width(100) 17 style_base.set_height(lv.SIZE.CONTENT) 18 19 # Set only the properties that should be different 20 style_warning = lv.style_t() 21 style_warning.init() 22 style_warning.set_bg_color(lv.palette_main(lv.PALETTE.YELLOW)) 23 style_warning.set_border_color(lv.palette_darken(lv.PALETTE.YELLOW, 3)) 24 style_warning.set_text_color(lv.palette_darken(lv.PALETTE.YELLOW, 4)) 25 26 # Create an object with the base style only 27 obj_base = lv.obj(lv.scr_act()) 28 obj_base.add_style(style_base, 0) 29 obj_base.align(lv.ALIGN.LEFT_MID, 20, 0) 30 31 label = lv.label(obj_base) 32 label.set_text("Base") 33 label.center() 34 35 # Create another object with the base style and earnings style too 36 obj_warning = lv.obj(lv.scr_act()) 37 obj_warning.add_style(style_base, 0) 38 obj_warning.add_style(style_warning, 0) 39 obj_warning.align(lv.ALIGN.RIGHT_MID, -20, 0) 40 41 label = lv.label(obj_warning) 42 label.set_text("Warning") 43 label.center()