|
From: Andy T. <an...@ha...> - 2002-02-19 11:45:42
|
Evening all, Its late, but I can't find any examples of what I want to do anywhere. This is a fairly frequent occurrence in the world of relational databases and I've been scratching my head trying to figure out how to represent it in PythonCard. Enough teasing, I have a table which contains keys and descriptions and I want to display the available descriptions in a 'choice' widget. Which is fairly easy. But when the user selects an element in the choice widget I want my code to know the corresponding key value. Is there any way to associate multiple items (say tuples?) with a choice widget? At the moment I'm returning the key-description pairs into a dictionary, so of course it would be nice to just get the key from the description value but I don't know of a way to do this in ordinary Python, unless I am being more of an idiot than usual. I don't think I can associate multiple values with each item in PythonCard (or wxPython for that matter) so I probably need to do this in my program. But, and this is a big but, I don't want to have to iterate through all of the available key-description pairs to find the key I'm looking for based on the value from the choice widget. Any suggestions? Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. Smiggins Hole 2010 - Unleash the Mongrel |