Skip to content

Commit ef4eba9

Browse files
saved_functions.py: add gif code
1 parent 6181a08 commit ef4eba9

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

draft_code/saved_functions.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,63 @@ def file_explorer_event_cb(e):
219219
# PNG:
220220
with open("/icon_64x64.png", 'rb') as f:
221221
image_data = f.read()
222-
223222
image_dsc = lv.image_dsc_t({
224223
'data_size': len(image_data),
225224
'data': image_data
226225
})
227-
228226
image1 = lv.image(lv.screen_active())
229227
image1.set_src(image_dsc)
230228
image1.set_pos(150,100)
231229

232230

233231

234232

233+
# GIF:
234+
#with open("../icons/spongebob_happy_love_it.gif", 'rb') as f:
235+
with open("../icons/corel-draw-icon-5662.png", 'rb') as f:
236+
with open("../icons/cpu_3dbd2b17ab4c68a4eb7e4034ab7c1c0e.jpg", 'rb') as f:
237+
with open("../icons/pngtree-update-icon-glossy-blue-round-button-symbol-rotate-button-photo-image_18021430.jpg", 'rb') as f:
238+
with open("../icons/hello_world_8844577_64x64.png", 'rb') as f: # one of the only images that works!
239+
with open("../icons/Spinning-Wheel-Vector-PNG-Cutout_64x64.png", 'rb') as f: # this also works...
240+
with open("../icons/pngtree-update-icon-glossy-blue-round-button-symbol-rotate-button-photo-image_18021430_square.png", 'rb') as f: # dontwork
241+
print("loading image...")
242+
image_data = f.read()
243+
image_dsc = lv.image_dsc_t({
244+
'data_size': len(image_data),
245+
'data': image_data
246+
})
247+
print(f"loaded {len(image_data)} bytes")
248+
screen = lv.screen_active()
249+
screen.clean()
250+
image = lv.image(screen)
251+
image.set_src(image_dsc)
252+
#image1.set_pos(10,10)
253+
#image.set_size(323,404)
254+
image.align(lv.ALIGN.TOP_MID, 0, 0)
255+
print("done")
256+
257+
258+
# lv.gd_open_gif_file())
259+
260+
#with open("../icons/graphics-snakes-834669.gif", 'rb') as f: # works
261+
with open("../icons/spongebob_happy_love_it.gif", 'rb') as f: # works
262+
with open("../icons/big-buck-bunny_320x180.gif", 'rb') as f: # works
263+
print("loading image...")
264+
image_data = f.read()
265+
image_dsc = lv.image_dsc_t({
266+
'data_size': len(image_data),
267+
'data': image_data
268+
})
269+
print(f"loaded {len(image_data)} bytes")
270+
screen = lv.screen_active()
271+
screen.clean()
272+
gif = lv.gif(screen)
273+
gif.set_src(image_dsc)
274+
gif.align(lv.ALIGN.TOP_MID, 0, 0)
275+
print("done")
276+
277+
278+
235279
# BIN
236280
with open("/icon_64x64.bin", 'rb') as f:
237281
image_data = f.read()

0 commit comments

Comments
 (0)