acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_calendar_1.py (949B)
1 2 def event_handler(evt): 3 code = evt.get_code() 4 5 if code == lv.EVENT.VALUE_CHANGED: 6 source = evt.get_current_target() 7 date = lv.calendar_date_t() 8 if source.get_pressed_date(date) == lv.RES.OK: 9 calendar.set_today_date(date.year, date.month, date.day) 10 print("Clicked date: %02d.%02d.%02d"%(date.day, date.month, date.year)) 11 12 13 calendar = lv.calendar(lv.scr_act()) 14 calendar.set_size(200, 200) 15 calendar.align(lv.ALIGN.CENTER, 0, 20) 16 calendar.add_event_cb(event_handler, lv.EVENT.ALL, None) 17 18 calendar.set_today_date(2021, 02, 23) 19 calendar.set_showed_date(2021, 02) 20 21 # Highlight a few days 22 highlighted_days=[ 23 lv.calendar_date_t({'year':2021, 'month':2, 'day':6}), 24 lv.calendar_date_t({'year':2021, 'month':2, 'day':11}), 25 lv.calendar_date_t({'year':2021, 'month':2, 'day':22}) 26 ] 27 28 calendar.set_highlighted_dates(highlighted_days, len(highlighted_days)) 29 30 lv.calendar_header_dropdown(calendar)