example: remove the MicroPython examples

See #4347
This commit is contained in:
Gabor Kiss-Vamosi
2023-12-21 10:02:40 +01:00
parent 32c6bc5bd7
commit 469c2cfcef
160 changed files with 0 additions and 18897 deletions

View File

@@ -1,26 +0,0 @@
#!/opt/bin/lv_micropython -i
import usys as sys
import lvgl as lv
import display_driver
# Create an image from the png file
try:
with open('../../assets/image_cogwheel_argb.png','rb') as f:
png_data = f.read()
except:
print("Could not find image_cogwheel_argb.png")
sys.exit()
image_cogwheel_argb = lv.image_dsc_t({
'data_size': len(png_data),
'data': png_data
})
image1 = lv.image(lv.screen_active())
image1.set_src(image_cogwheel_argb)
image1.align(lv.ALIGN.CENTER, 0, -20)
image1.set_size(200, 200)
image2 = lv.image(lv.screen_active())
image2.set_src(lv.SYMBOL.OK + "Accept")
image2.align_to(image1, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)

View File

@@ -1,64 +0,0 @@
#!/opt/bin/lv_micropython -i
import usys as sys
import lvgl as lv
import display_driver
# Create an image from the png file
try:
with open('../../assets/image_cogwheel_argb.png','rb') as f:
png_data = f.read()
except:
print("Could not find image_cogwheel_argb.png")
sys.exit()
image_cogwheel_argb = lv.image_dsc_t({
'data_size': len(png_data),
'data': png_data
})
def create_slider(color):
slider = lv.slider(lv.screen_active())
slider.set_range(0, 255)
slider.set_size(10, 200)
slider.set_style_bg_color(color, lv.PART.KNOB)
slider.set_style_bg_color(color.darken(lv.OPA._40), lv.PART.INDICATOR)
slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None)
return slider
def slider_event_cb(e):
# Recolor the image based on the sliders' values
color = lv.color_make(red_slider.get_value(), green_slider.get_value(), blue_slider.get_value())
intense = intense_slider.get_value()
image1.set_style_image_recolor_opa(intense, 0)
image1.set_style_image_recolor(color, 0)
#
# Demonstrate runtime image re-coloring
#
# Create 4 sliders to adjust RGB color and re-color intensity
red_slider = create_slider(lv.palette_main(lv.PALETTE.RED))
green_slider = create_slider(lv.palette_main(lv.PALETTE.GREEN))
blue_slider = create_slider(lv.palette_main(lv.PALETTE.BLUE))
intense_slider = create_slider(lv.palette_main(lv.PALETTE.GREY))
red_slider.set_value(lv.OPA._20, lv.ANIM.OFF)
green_slider.set_value(lv.OPA._90, lv.ANIM.OFF)
blue_slider.set_value(lv.OPA._60, lv.ANIM.OFF)
intense_slider.set_value(lv.OPA._50, lv.ANIM.OFF)
red_slider.align(lv.ALIGN.LEFT_MID, 25, 0)
green_slider.align_to(red_slider, lv.ALIGN.OUT_RIGHT_MID, 25, 0)
blue_slider.align_to(green_slider, lv.ALIGN.OUT_RIGHT_MID, 25, 0)
intense_slider.align_to(blue_slider, lv.ALIGN.OUT_RIGHT_MID, 25, 0)
# Now create the actual image
image1 = lv.image(lv.screen_active())
image1.set_src(image_cogwheel_argb)
image1.align(lv.ALIGN.RIGHT_MID, -20, 0)
intense_slider.send_event(lv.EVENT.VALUE_CHANGED, None)

View File

@@ -1,55 +0,0 @@
#!/opt/bin/lv_micropython -i
import usys as sys
import lvgl as lv
import display_driver
# Create an image from the png file
try:
with open('../../assets/image_cogwheel_argb.png','rb') as f:
png_data = f.read()
except:
print("Could not find image_cogwheel_argb.png")
sys.exit()
image_cogwheel_argb = lv.image_dsc_t({
'data_size': len(png_data),
'data': png_data
})
def set_angle(image, v):
image.set_angle(v)
def set_zoom(image, v):
image.set_zoom(v)
#
# Show transformations (zoom and rotation) using a pivot point.
#
# Now create the actual image
image = lv.image(lv.screen_active())
image.set_src(image_cogwheel_argb)
image.align(lv.ALIGN.CENTER, 50, 50)
image.set_pivot(0, 0) # Rotate around the top left corner
a1 = lv.anim_t()
a1.init()
a1.set_var(image)
a1.set_custom_exec_cb(lambda a,val: set_angle(image,val))
a1.set_values(0, 3600)
a1.set_time(5000)
a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a1)
a2 = lv.anim_t()
a2.init()
a2.set_var(image)
a2.set_custom_exec_cb(lambda a,val: set_zoom(image,val))
a2.set_values(128, 256)
a2.set_time(5000)
a2.set_playback_duration(3000)
a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a2)

View File

@@ -1,45 +0,0 @@
def ofs_y_anim(image, v):
image.set_offset_y(v)
# print(image,v)
# Create an image from the png file
try:
with open('../../assets/img_skew_strip.png','rb') as f:
png_data = f.read()
except:
print("Could not find img_skew_strip.png")
sys.exit()
image_skew_strip = lv.image_dsc_t({
'data_size': len(png_data),
'data': png_data
})
#
# Image styling and offset
#
style = lv.style_t()
style.init()
style.set_bg_color(lv.palette_main(lv.PALETTE.YELLOW))
style.set_bg_opa(lv.OPA.COVER)
style.set_image_recolor_opa(lv.OPA.COVER)
style.set_image_recolor(lv.color_black())
image = lv.image(lv.screen_active())
image.add_style(style, 0)
image.set_src(image_skew_strip)
image.set_size(150, 100)
image.center()
a = lv.anim_t()
a.init()
a.set_var(image)
a.set_values(0, 100)
a.set_time(3000)
a.set_playback_duration(500)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a,val: ofs_y_anim(image,val))
lv.anim_t.start(a)