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_tabview_2.py (1412B)
1 def scroll_begin_event(e): 2 3 #Disable the scroll animations. Triggered when a tab button is clicked */ 4 if e.get_code() == lv.EVENT.SCROLL_BEGIN: 5 a = lv.anim_t.__cast__(e.get_param()) 6 if a: 7 a.time = 0 8 9 # Create a Tab view object 10 tabview = lv.tabview(lv.scr_act(), lv.DIR.LEFT, 80) 11 tabview.get_content().add_event_cb(scroll_begin_event, lv.EVENT.SCROLL_BEGIN, None) 12 13 tabview.set_style_bg_color(lv.palette_lighten(lv.PALETTE.RED, 2), 0) 14 15 tab_btns = tabview.get_tab_btns() 16 tab_btns.set_style_bg_color(lv.palette_darken(lv.PALETTE.GREY, 3), 0) 17 tab_btns.set_style_text_color(lv.palette_lighten(lv.PALETTE.GREY, 5), 0) 18 tab_btns.set_style_border_side(lv.BORDER_SIDE.RIGHT, lv.PART.ITEMS | lv.STATE.CHECKED) 19 20 21 # Add 3 tabs (the tabs are page (lv_page) and can be scrolled 22 tab1 = tabview.add_tab("Tab 1") 23 tab2 = tabview.add_tab("Tab 2") 24 tab3 = tabview.add_tab("Tab 3") 25 tab4 = tabview.add_tab("Tab 4") 26 tab5 = tabview.add_tab("Tab 5") 27 28 tab2.set_style_bg_color(lv.palette_lighten(lv.PALETTE.AMBER, 3), 0) 29 tab2.set_style_bg_opa(lv.OPA.COVER, 0) 30 31 # Add content to the tabs 32 label = lv.label(tab1) 33 label.set_text("First tab") 34 35 label = lv.label(tab2) 36 label.set_text("Second tab") 37 38 label = lv.label(tab3) 39 label.set_text("Third tab") 40 41 label = lv.label(tab4) 42 label.set_text("Forth tab") 43 44 label = lv.label(tab5) 45 label.set_text("Fifth tab") 46 47 tabview.get_content().clear_flag(lv.obj.FLAG.SCROLLABLE) 48