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_label_2.py (864B)

      1 #
      2 # Create a fake text shadow
      3 #
      4 
      5 # Create a style for the shadow
      6 style_shadow = lv.style_t()
      7 style_shadow.init()
      8 style_shadow.set_text_opa(lv.OPA._30)
      9 style_shadow.set_text_color(lv.color_black())
     10 
     11 # Create a label for the shadow first (it's in the background)
     12 shadow_label = lv.label(lv.scr_act())
     13 shadow_label.add_style(style_shadow, 0)
     14 
     15 # Create the main label
     16 main_label = lv.label(lv.scr_act())
     17 main_label.set_text("A simple method to create\n"
     18                    "shadows on a text.\n"
     19                    "It even works with\n\n"
     20                    "newlines     and spaces.")
     21 
     22 # Set the same text for the shadow label
     23 shadow_label.set_text(lv.label.get_text(main_label))
     24 
     25 # Position the main label
     26 main_label.align(lv.ALIGN.CENTER, 0, 0)
     27 
     28 # Shift the second label down and to the right by 2 pixel
     29 shadow_label.align_to(main_label, lv.ALIGN.TOP_LEFT, 2, 2)
     30