def _tabs_viewport_resize_children(self): # allow x_align to take effect only if tabs fit. x = max(self.tabs_container.x, self._tabs_viewport.width - self.tabs_container.width - 1) Bin.resize_children(self._tabs_viewport) if self.tabs_container.width > self._tabs_viewport.width: self.tabs_container.x = x self._position_tabs()