I am building a wxpython project, I have a list of elements that are a class instances. Each of this elements has an attribute title. In a ListBox I want to display only the titles, and when the title selected, after we GetSelection from listbox, the instance should be returned and not just the title. Is this achievable ?
Note: Searching for the string is out of question because names(titles) may be recurring.
Thank you.
Put your instances in a list
Use GetSelection to retrieve the index of the item you selected from the listbox
Get the corresponding instance from that index in the list
WxPython, How to fill ListBox with class attributes