2021-06-07 13:56:08 +02:00
|
|
|
def event_handler(e):
|
|
|
|
code = e.get_code()
|
2021-07-07 18:04:46 +03:00
|
|
|
obj = e.get_target()
|
2021-06-07 13:56:08 +02:00
|
|
|
if code == lv.EVENT.VALUE_CHANGED:
|
2021-02-08 09:53:03 +01:00
|
|
|
option = " "*10
|
|
|
|
obj.get_selected_str(option, len(option))
|
2021-06-07 13:56:08 +02:00
|
|
|
print("Selected month: " + option.strip())
|
|
|
|
|
|
|
|
#
|
|
|
|
# An infinite roller with the name of the months
|
|
|
|
#
|
2021-02-08 09:53:03 +01:00
|
|
|
|
|
|
|
roller1 = lv.roller(lv.scr_act())
|
|
|
|
roller1.set_options("\n".join([
|
2021-06-07 13:56:08 +02:00
|
|
|
"January",
|
|
|
|
"February",
|
|
|
|
"March",
|
|
|
|
"April",
|
|
|
|
"May",
|
|
|
|
"June",
|
|
|
|
"July",
|
|
|
|
"August",
|
|
|
|
"September",
|
|
|
|
"October",
|
|
|
|
"November",
|
|
|
|
"December"]),lv.roller.MODE.INFINITE)
|
2021-02-08 09:53:03 +01:00
|
|
|
|
|
|
|
roller1.set_visible_row_count(4)
|
2021-06-07 13:56:08 +02:00
|
|
|
roller1.center()
|
|
|
|
roller1.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
|
|
|
|