KivyMD
KivyMD copied to clipboard
MDTabsSecondary does not allow custom height
Description of the Bug
The MDTabsSecondary component does not allow a custom height to be defined. I attempted to explicitly set the height of the MDTabsSecondary instance, MDTabsItemSecondary instances, and MDTabsItemText instances at initialization. None of these had any impact on the overall height of the tab bar.
My workaround is to define a function executed by Clock.schedule_once() to dynamically resize all the tab bar components post initialization:
def __init__(self):
self.tab_bar = MDTabsSecondary(...)
self.tab_bar.add_widget(...)
self.tab_bar.add_widget(...)
Clock.schedule_once(lambda x: self.update_tab_bar_height())
#
def update_tab_bar_height(self):
TAB_BAR_HEIGHT = 55
self.tab_bar.height = TAB_BAR_HEIGHT
self.tab_bar.ids.tab_scroll.height = TAB_BAR_HEIGHT
tab_list = self.tab_bar.get_tabs_list()
for tab_item in tab_list:
tab_item.height = TAB_BAR_HEIGHT
tab_item.tab_item_text.height = TAB_BAR_HEIGHT
#
#
Versions
OS: Windows 11 Enterprise Python: 3.10.11 Kivy: 2.3.0 KivyMD: 2.0.1.dev0