wx.ComboBox

What is the method of loading a combobox post-creation?

Currently I load choices with a list at program start:
wx.ComboBox(choices=mylist

But I'd like to update that when the list changes.

Also, is there a way to limit the size of the dropdown so only 'x' entries are
displayed at a time?

Thanks,

Jeff

Seg, 2005-06-06 às 07:04 -0400, Jeff Elkins escreveu:

What is the method of loading a combobox post-creation?

Currently I load choices with a list at program start:
wx.ComboBox(choices=mylist

But I'd like to update that when the list changes.

You have several methods:

Append(self, String item, PyObject clientData=None):
Adds the item to the control, associating the given data with the item
if not None. The return value is the index of the newly added item
which may be different from the last one if the control is sorted (e.g.
has wx.LB_SORT or wx.CB_SORT style)

AppendItems(self, List strings):
Apend several items at once to the control. Notice that calling this
method may be much faster than appending the items one by one if you
need to add a lot of items.

Insert(self, String item, int pos, PyObject clientData=None):
Insert an item into the control before the item at the ``pos`` index,
optionally associating some data object with the item.

This methods are from wxControlWithItems which ComboBox is derived from.

Ricardo

Jeff Elkins wrote:

What is the method of loading a combobox post-creation?

Currently I load choices with a list at program start: wx.ComboBox(choices=mylist

But I'd like to update that when the list changes.

ComboBox inherits the Append(str), Insert(str, pos), and AppendItems(list_of_str) methods. See wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

Also, is there a way to limit the size of the dropdown so only 'x' entries are displayed at a time?

No, I think that the dropdown size is automatically calcualted.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks, .Clear followed by .AppendItems was just what I was looking for.

Jeff

···

On Monday 06 June 2005 01:25 pm, Robin Dunn wrote:

ComboBox inherits the Append(str), Insert(str, pos), and
AppendItems(list_of_str) methods. See
wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

> Also, is there a way to limit the size of the dropdown so only 'x'
> entries are displayed at a time?

No, I think that the dropdown size is automatically calcualted.