title: Objects from Tkinter controls: how to go beyond StringVar, IntVar, DoubleVar, BooleanVar?
body: <p>I'm trying to write a GUI in Tkinter to select one among several complex Python objects. They represent records from a database; if needed, I could recover objects from a map given their integer unique id.</p>
  
  <p>In an ideal world, the Listbox and OptionMenu widgets would accept a sequence of arbitrary objects and a function to call to obtain a string to display from those arbitrary objects; and their variables would give one of those objects, without unwanted conversions.</p>
  
  <p>Instead, no widget and, more crucially, no variable type deals with anything other than strings or strings converted to numbers and truth values.
  I have no way to get my arbitrary objects back, and I cannot make a list containing id values because they would display the id, not a sensible string representation.</p>
  
  <p>As a test, I put tuples in an OptionMenu with a StringVar and they were converted to strings.</p>
  
  <p>Are there exotic widgets or techniques that I can use to get() objects from a variable or to show in the widget a string that is not what is put in the widget's variable?
  The best approach I can think of is a menu full of dynamically generated lambdas for commands, but it would be ugly and potentially too large.</p>