Files
MicroPythonOS/internal_filesystem/apps/com.example.helloworld/assets/hello.py
T

24 lines
608 B
Python
Raw Normal View History

2025-05-03 10:09:39 +02:00
# START OF COPY-PASTE FROM https://sim.lvgl.io/v9.0/micropython/ports/webassembly/
2025-05-02 09:12:52 +02:00
2025-05-03 10:09:39 +02:00
# Initialize
2025-05-02 09:12:52 +02:00
2025-05-03 10:09:39 +02:00
import display_driver
import lvgl as lv
2025-05-02 09:12:52 +02:00
2025-05-03 10:09:39 +02:00
# 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/
# Added: wait until the user navigates away instead of stopping immediately.
while lv.screen_active() == scr:
import time
2025-05-02 09:12:52 +02:00
time.sleep_ms(100)
2025-05-03 10:09:39 +02:00
print("User navigated away from the HelloWorld app. Bye bye!")