Message box... get_active_button_text() Issue

Using… lv_micropython master is v9

line 124, in task_handler
File “”, line 15, in event_cb
AttributeError: no such attribute

Simulator link

get_active_button_text() is in the docs

I tried on the simulator you sent, and the error was the same as yours.
In the official document’s Event introduction, there is a description:

In the event handler, lv_event_get_target(e) will return the button matrix and lv_event_get_current_target(e) will return the message box. lv_msgbox_get_active_btn(msgbox) and lv_msgbox_get_active_btn_text(msgbox) can be used to get the index and text of the clicked button.

Therefore, I made modifications to the event_cb method.

def event_cb(e):
    mbox = e.get_current_target_obj()
    print("Button %s clicked" % mbox.get_active_btn_text())

Then it can run normally.

Thank you that did the trick !!!
By the way that simulators is from the docs examples and should be updated.

It appears the simulator has been updated and now the code doesn’t work again.
Also I’m not able to save my simulator code so you’ll need to cut and paste below
into last saved link.

def event_cb(e):
    mbox = e.get_current_target_obj()
    print("Button %s clicked" % mbox.get_active_btn_text())

buttons = ["Apply", "Close", ""]

mbox1 = lv.msgbox(lv.screen_active(), "Hello", "This is a message box with two buttons.", buttons, True)
mbox1.add_event(event_cb, lv.EVENT.VALUE_CHANGED, None)
mbox1.center()

the code…
image

the error…