1def event_handler(evt):
2    code = evt.get_code()
3    obj  = evt.get_target()
4
5    if code == lv.EVENT.VALUE_CHANGED :
6        id = obj.get_selected_btn()
7        txt = obj.get_btn_text(id)
8
9        print("%s was pressed"%txt)
10
11btnm_map = ["1", "2", "3", "4", "5", "\n",
12            "6", "7", "8", "9", "0", "\n",
13            "Action1", "Action2", ""]
14
15btnm1 = lv.btnmatrix(lv.scr_act())
16btnm1.set_map(btnm_map)
17btnm1.set_btn_width(10, 2)        # Make "Action1" twice as wide as "Action2"
18btnm1.set_btn_ctrl(10, lv.btnmatrix.CTRL.CHECKABLE)
19btnm1.set_btn_ctrl(11, lv.btnmatrix.CTRL.CHECKED)
20btnm1.align(lv.ALIGN.CENTER, 0, 0)
21btnm1.add_event_cb(event_handler, lv.EVENT.ALL, None)
22
23
24#endif
25