Feed wxComboBox with dictionary/hash

Peter Decker pydecker at gmail.com
Thu Jun 22 13:01:05 EDT 2006


On 22 Jun 2006 06:45:25 -0700, Roland Rickborn
<rr_newsgroup_deleted at gmx.net> wrote:

> My first question:
> how can a wx.ComboBox be fed by a dictionary?

This is one of those annoying things about wxPython that made me so
happy to switch to using the dabo.ui wrapper for wxPython instead. You
can set up the dabo.ui.dComboBox like this, given a dictionary 'dd':

cb = dabo.ui.dComboBox(self)
cb.Choices = dd.Values()
cb.Keys = dd

You can then get the selected item via the StringValue property, or
its associated key via the KeyValue property. That's it. Simple.

-- 

# p.d.



More information about the Python-list mailing list