def build_cocktail_buttons(self, menu): for key, recipe in menu.items(): b = ToggleButton(text=recipe.name, size_hint=(1 / MENU_COLS, 1 / MENU_ROWS), halign='center', group='recipe', allow_no_selection=False, on_press=lambda b: self.stage_recipe(b.recipe)) b.recipe = recipe # set text width to 85% of the button width b.bind(width=lambda bt, w: setattr(bt, 'text_size', (w*.85, None))) self.menu_buttons.add_widget(b) self.stage_recipe(self.menu_buttons.children[-1].recipe) self.menu_buttons.children[-1].state = 'down'