Manual call back not working

Using v8.01

def pwr_cb(event):
	print('poewring off')

print('call back loaded')

# lv.event_send(pwr_cb, lv.EVENT.CLICKED, None)

Simulator Link…

The lv.event_send(pwr_cb, lv.EVENT.CLICKED, None)
can be copy and paste into the prompt >

You should send events to objects, not functions.


why does it return 1

simulator link…
https://sim.lvgl.io/v8.1/micropython/ports/javascript/index.html?script_direct=42e99fd157804858ce5aba4a4c290d42e1bb898d


How ??

It returns lv.RES.OK, or lv.RES.INV if the object was deleted in the event.

As I mentioned above - you should send events to objects, not functions.
Here is your fixed script.

Got IT…
You could have just as easily said…
send events to your object “pwr_btn”
not to the function “pwrOff_btn”
Thank you nonetheless.

A pictures worth a thousand words.