Skip to content

Commit ae62538

Browse files
update hello_world example
1 parent 7433e98 commit ae62538

File tree

1 file changed

+7
-8
lines changed
  • internal_filesystem/apps/com.example.helloworld/assets

1 file changed

+7
-8
lines changed

internal_filesystem/apps/com.example.helloworld/assets/hello.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# START OF COPY-PASTE FROM https://sim.lvgl.io/v9.0/micropython/ports/webassembly/
1+
import mpos.ui
22

3-
# Initialize
3+
def button_click(e):
4+
print("Button clicked!")
45

5-
import display_driver # not needed, but included because the LVGL simulator does it
6-
import lvgl as lv
6+
scr = lv.obj()
77

88
# Create a button with a label
9-
10-
scr = lv.obj()
119
btn = lv.button(scr)
1210
btn.align(lv.ALIGN.CENTER, 0, 0)
11+
#btn.set_size(lv.pct(100),lv.pct(100))
12+
btn.add_event_cb(button_click,lv.EVENT.CLICKED,None)
1313
label = lv.label(btn)
1414
label.set_text('Hello World!')
15-
lv.screen_load(scr)
1615

17-
# END OF COPY-PASTE FROM https://sim.lvgl.io/v9.0/micropython/ports/webassembly/
16+
mpos.ui.load_screen(scr)
1817

1918
# Optional janitor that cleans up when the app is backgrounded:
2019
def janitor_cb(timer):

0 commit comments

Comments
 (0)