Description
pygame_gui understandably follows the event model of pygame, but that can be inefficient and unnecessary when rather than dozens to thousands of objects processing the same event that doesn't apply to them, a single call can be made to achieve the desired result.
To increase efficiency, and make code easier to debug, I end up creating my own approach to this on top of the existing menu system (UIDropDownMenu in my case), where I keep a dictionary of menu items and which method to call when the menu item is selected.
commands = {
'Village': None,
'Recruit character (100 coins)': self.create_character,
'Build...': self.build_menu_item_chosen,
}
I propose that UIDropDownMenu, at minimum, allow for a dictionary of menu items names and the associated method pointer to call. If a dictionary is provided instead of a list, the associated method would be called directly and the event process would be skipped. The existing API doesn't need to change, except for specifying that the options_list can be either a list or dictionary.
I'm going to take a crack at implementing this, so this request is really for any discussion needed...