Files
MicroPythonOS/internal_filesystem/apps/com.example.helloworld/assets/hello.py
T
Thomas Farstrike 464d1bbc9e cputest: optimize
2025-05-16 12:36:46 +02:00

27 lines
848 B
Python

# START OF COPY-PASTE FROM https://sim.lvgl.io/v9.0/micropython/ports/webassembly/
# Initialize
import display_driver # not needed, but included because the LVGL simulator does it
import lvgl as lv
# Create a button with a label
scr = lv.obj()
btn = lv.button(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text('Hello World!')
lv.screen_load(scr)
# END OF COPY-PASTE FROM https://sim.lvgl.io/v9.0/micropython/ports/webassembly/
# Optional janitor that cleans up when the app is backgrounded:
def janitor_cb(timer):
if lv.screen_active() != scr:
print("app backgrounded, cleaning up...")
janitor.delete()
# No cleanups to do, but in a real app, you might stop timers, deinitialize hardware devices you used, close network connections, etc.
janitor = lv.timer_create(janitor_cb, 1000, None)