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_img_1.py (790B)

      1 #!/opt/bin/lv_micropython -i
      2 import usys as sys
      3 import lvgl as lv
      4 import display_driver
      5 from imagetools import get_png_info, open_png
      6 
      7 # Register PNG image decoder
      8 decoder = lv.img.decoder_create()
      9 decoder.info_cb = get_png_info
     10 decoder.open_cb = open_png
     11 
     12 # Create an image from the png file
     13 try:
     14     with open('../../assets/img_cogwheel_argb.png','rb') as f:
     15         png_data = f.read()
     16 except:
     17     print("Could not find img_cogwheel_argb.png")
     18     sys.exit()
     19 
     20 img_cogwheel_argb = lv.img_dsc_t({
     21   'data_size': len(png_data),
     22   'data': png_data
     23 })
     24 
     25 img1 = lv.img(lv.scr_act())
     26 img1.set_src(img_cogwheel_argb)
     27 img1.align(lv.ALIGN.CENTER, 0, -20)
     28 img1.set_size(200, 200)
     29 
     30 img2 = lv.img(lv.scr_act())
     31 img2.set_src(lv.SYMBOL.OK + "Accept")
     32 img2.align_to(img1, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)