Skip to content Skip to sidebar Skip to footer

Kivy - TabbedPanel Headers Slight Offset

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 o

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

Post a Comment for "Kivy - TabbedPanel Headers Slight Offset"