我使用的是TabbedPanel(默认为tab_pos: "top_left"
)但是标题(正如人们在文档中看到的那样)稍微不在左边。这就像应用了1px的小填充左边一样。我无法弄清楚如何配置它。任何见解?谢谢!
答案 0 :(得分:1)
一个hacky,非漂亮的解决方案:
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()