I am using a TabbedPanel in Kivy, it works perfectly well, but I would like to customize the tab buttons a bit and add a icon next to the text.
Right now I have something like this :
And I would like something like that :
My kv file is as follows :
<KivyMasterPanel>
do_default_tab: False
id: MasterPanel
tab_width: self.size[0]/len(self.tab_list)
TabbedPanelItem:
id: tab_A
text: 'A'
TabbedPanelItem:
id: tab_B
text: 'B'
TabbedPanelItem:
id: tab_C
text: 'C'
Is there something I can use instead of TabbedPannelItem.text to put a BoxLayout or something inside. If possible I would like to be able to create my tabs using a kv file, but if it is not possible, no problem.
Thank you all in advance for your help.
Make a custom TabbedPanelItem
, where you'll add image background with Rectangle
<TPI@TabbedPanelItem>:
canvas:
Rectangle:
source: <your_img>
size: self.size
pos: self.pos
and use the custom one instead of TabbedPanelItem
in your KivyMasterPanel
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.