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_spinbox_1.py (905B)
1 def increment_event_cb(e): 2 code = e.get_code() 3 if code == lv.EVENT.SHORT_CLICKED or code == lv.EVENT.LONG_PRESSED_REPEAT: 4 spinbox.increment() 5 6 def decrement_event_cb(e): 7 code = e.get_code() 8 if code == lv.EVENT.SHORT_CLICKED or code == lv.EVENT.LONG_PRESSED_REPEAT: 9 spinbox.decrement() 10 11 spinbox = lv.spinbox(lv.scr_act()) 12 spinbox.set_range(-1000, 25000) 13 spinbox.set_digit_format(5, 2) 14 spinbox.step_prev() 15 spinbox.set_width(100) 16 spinbox.center() 17 18 h = spinbox.get_height() 19 20 btn = lv.btn(lv.scr_act()) 21 btn.set_size(h, h) 22 btn.align_to(spinbox, lv.ALIGN.OUT_RIGHT_MID, 5, 0) 23 btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0) 24 btn.add_event_cb(increment_event_cb, lv.EVENT.ALL, None) 25 26 btn = lv.btn(lv.scr_act()) 27 btn.set_size(h, h) 28 btn.align_to(spinbox, lv.ALIGN.OUT_LEFT_MID, -5, 0) 29 btn.set_style_bg_img_src(lv.SYMBOL.MINUS, 0) 30 btn.add_event_cb(decrement_event_cb, lv.EVENT.ALL, None)