I'm using the TabbedPanel (with the default tab_pos: "top_left"
) but the headers (as one can see in the docs) are slighty not on the left. It's like there is a small padding-left of 1px which is applied. I can't figure out how to configure that. Any insights? Thanks!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
A hacky, non-pretty solution:
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.lang import Builder
Builder.load_string('''
<MyWidget>:
TabbedPanelItem:
text: 'tab1'
TabbedPanelItem:
text: 'tab2'
''')
class MyWidget(TabbedPanel):
def __init__(self, **kwargs):
super(MyWidget, self).__init__(**kwargs)
self._tab_layout.padding = [0, 0, 0, 0]
class MyApp(App):
def build(self):
return MyWidget()
if __name__ == '__main__':
MyApp().run()