Hi,
I presented this problem yesterday but I deleted it because I wanted to give it another try.
I’m trying to handle the apply cb from the keyboard.
I have been monitoring the events and I don’t get the apply event. I might be that I have to read if the apply even has been triggered and is not like the click one.
I rode the callback documentation several times but I don’t get it.
Hi @Claudio_Gil!
Please send us the code wrote that is trying to use callbacks.
We need to see what you are trying to do, because your question is too general.
I just want to do an if when the apply button is pressed.
def event_handler(obj, event):
if event == lv.EVENT.APPLY:
print(“OK”)
I also where printing the events:
def event_handlerkb(obj, event):
print(“Key:”, lv.EVENT.KEY)
print(“Event:”, event)
print("|||||||||||||||||||||||||||||||||||||||||||||||||||")
if event == lv.EVENT.APPLY:
print(“Lets go”)
I’m not registering the callback, that might be the problem…
I didn’t found a fully working example so I can see how the callbacks are being handled.
Do you have any example? I might be missing the right documentation.
I see you don’t register any keyboard driver.
Without a keyboard driver you will not be able to detect key press.
I didn’t know it was possible to attach a keyboard to the Omega Dash. Do you attach it through USB?
I’m using the virtual keyboard, sorry, I think I should pointed that. I didn’t think on the possibility of an USB keyboard.
My code is just the keyboard example buy I added the cb event
if testkeyboard:
# Create styles for the keyboard
rel_style = lv.style_t()
pr_style = lv.style_t()
lv.style_copy(rel_style, lv.style_btn_rel)
rel_style.body.radius = 0
rel_style.body.border.width = 1
lv.style_copy(pr_style, lv.style_btn_pr)
pr_style.body.radius = 0
pr_style.body.border.width = 1
# Create a keyboard and apply the styles
kb = lv.kb(lv.scr_act())
kb.set_cursor_manage(True)
kb.set_style(lv.kb.STYLE.BG, lv.style_transp_tight)
kb.set_style(lv.kb.STYLE.BTN_REL, rel_style)
kb.set_style(lv.kb.STYLE.BTN_PR, pr_style)
kb.set_event_cb(event_handlerkb) <-----Here is the cb I added
# Create a text area. The keyboard will write here
ta = lv.ta(lv.scr_act())
ta.align(None, lv.ALIGN.IN_TOP_MID, 0, 10)
ta.set_text("")
# Assign the text area to the keyboard
kb.set_ta(ta)
Many thanks Amirgon. I have been bussy all the day, sorry for my late response and sorry for not sending all the code from the start. I was trying a lot of different widgets and my code where a little bit untidy. Next time I’ll shove together all the code related with the problem and post it.