Kivy - TabbedPanel headers slight offset

て烟熏妆下的殇ゞ 提交于 2019-12-25 09:00:24

问题


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()


来源:https://stackoverflow.com/questions/42809080/kivy-tabbedpanel-headers-slight-offset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!