The truth is rarely pure and never simple

kivy: multiple header lines in tabbedpanel

By default, the TabbedPanel uses a GridLayout with the restriction of one row and 99 columns for the headers. This should be sufficient for most applications. However, it is more common to add a second row for the tabbed headers instead of trying to fit them all into one single row. Unfortunately, the way to do it is undocumented.

tabbed

You have to override the default settings for the TabbedPanelStrip class. Here is the only way I could think of (editing the kivy source is not an option!): I’m assuming you are using a *.kv file already. Add the following lines:

<TabbedPanelStrip>:
    rows: 2
    cols: 8
    spacing: 5

Now you can use your new functionality without major changes in your code. The only thing you have to keep in mind is the height adjustment:

tp = TabbedPanel(tab_height=120, tab_width=30, do_default_tab=False, tab_pos='top_mid')

Leave a comment

Your email address will not be published.

One thought on “kivy: multiple header lines in tabbedpanel”