fix(msgbox): fix micropython example
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
def back_event_handler(e):
|
||||
obj = e.get_target_obj()
|
||||
if menu.back_button_is_root(obj):
|
||||
mbox1 = lv.msgbox(lv.screen_active(), "Hello", "Root back button click.", None, True)
|
||||
mbox1.center()
|
||||
mbox1 = lv.msgbox(lv.screen_active())
|
||||
mbox1.add_title("Hello")
|
||||
mbox1.add_text("Root back button click.")
|
||||
mbox1.add_close_button()
|
||||
|
||||
# Create a menu object
|
||||
menu = lv.menu(lv.screen_active())
|
||||
|
||||
@@ -57,7 +57,10 @@ def back_event_handler(e,menu):
|
||||
# menu = lv_event_get_user_data(e);
|
||||
|
||||
if menu.back_button_is_root(obj) :
|
||||
mbox1 = lv.msgbox(None, "Hello", "Root back button click.", None, True)
|
||||
mbox1 = lv.msgbox(None)
|
||||
mbox1.add_title("Hello")
|
||||
mbox1.add_text("Root back button click.")
|
||||
mbox1.add_close_button()
|
||||
mbox1.center()
|
||||
|
||||
def switch_handler(e,menu):
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
def event_cb(e):
|
||||
mbox = e.get_target_obj()
|
||||
print("Button %s clicked" % mbox.get_active_button_text())
|
||||
btn = e.get_target_obj()
|
||||
label = btn.get_child(btn)
|
||||
print("Button %s clicked" % label.get_text())
|
||||
|
||||
buttons = ["Apply", "Close", ""]
|
||||
|
||||
mbox1 = lv.msgbox(lv.screen_active(), "Hello", "This is a message box with two buttons.", buttons, True)
|
||||
mbox1.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None)
|
||||
mbox1.center()
|
||||
mbox1 = lv.msgbox(lv.screen_active())
|
||||
mbox1.add_title("Hello")
|
||||
mbox1.add_text("This is a message box with two buttons")
|
||||
mbox1.add_close_button()
|
||||
|
||||
btn = mbox1.add_footer_button("Apply")
|
||||
btn.add_event_cb(event_cb, lv.EVENT.CLICKED, None)
|
||||
btn = mbox1.add_footer_button("Cancel")
|
||||
btn.add_event_cb(event_cb, lv.EVENT.CLICKED, None)
|
||||
|
||||
Reference in New Issue
Block a user