def create_drop_down(self, button, list=None, icon=None, border=None): border.rgb = get_color_from_hex('#023b80') icon.color = get_color_from_hex('#023b80') drop_down = DropDown() drop_down.fbind('on_dismiss', self.on_deselect, icon=icon, border=border) drop_down.bind(on_select=lambda instance, x: (setattr(button.ids.category, 'text', x), setattr(button.ids.category, 'color', get_color_from_hex('#023b80')), setattr(button.ids.icon, 'color', get_color_from_hex('#023b80')))) for text in list: new_item = CustomMenu(size_hint=(1, None), height=dp(45), text=text) new_item.bind( on_release=lambda item: drop_down.select(item.text)) drop_down.add_widget(new_item) drop_down.open(button)