Reputation: 31
I got a wxPython combobox which contains a list of sections of my .ini file. I add new section while my program is running. And I also want to see the NEW entries in my combobox.
How can I refresh / update it?
My code :
self.cbxCfgProfiles = wx.ComboBox(self, pos=(170, 120), size=(440, -1),
choices=getCfgProfileList(), style=wx.CB_DROPDOWN)
When I restart my program I see the new entries.
I try already self.cbxCfgProfiles.Refresh()
in my method. It does not work. :(
Upvotes: 3
Views: 3484
Reputation: 33111
If you have a new list of strings that you want to set the combobox to, the SetItems()
method is probably the easiest way. It clears the control and then adds all the new selections.
Upvotes: 3
Reputation: 2368
Sorry I only worked with pyGtk until now, and one alternative for you it's to make a thread that verifies wheter there is a new section at your .ini file that isn't on a dict with the same values already loaded to your combobox and the items that wheren't on that dict you can insert them. I think this will help:
wx.ComboBox.Insert()
Upvotes: 0