Roland Rickborn wrote: > Hi folks, ... > As the subject says, I'd like to feed a wx.ComboBox with a > dictionary/hash. According to the posting of Stano Paska ("wxComboBox > <> combobox", 20 Jul. 2004), there seems to be a way to do this: > > > You must use something like > > combo.Append('aaa', 'a') > > combo.Append('bbb', 'b') > > ... > > My problem is: > my data has thousands of entries. Therefore, I'd like to feed the > combobox with a dictionary (which itself is fed by a database query). > > My first question: > how can a wx.ComboBox be fed by a dictionary? > ... > TIA, > Roland R.
I don't know if this is the best way to do this, but you could just feed the wx.ComboBox from the dict in a loop like this: for k, v in data_dict.iteritems(): combo.Append(k, v) >From the manual link that Iain King posted (http://wxwidgets.org/manuals/2.6.3/wx_wxcontrolwithitems.html#wxcontrolwithitems) it appears that you might be able to pass a list of strings to the Append() method. However, it also appears that you wouldn't be able to associate any "clientData" with the strings. Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list