Re: Can choice control have dynamically generated options ?
"Werner F. Bruhin" <[email protected]> Wed, 01 Apr 2009 16:47:01 +0200
| Newsgroups | gmane.comp.ide.boa-constructor.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Tanay Shah wrote:
> Hello there,
>
> I want to know if it is possible to have the options in a wx.Choice
> control in a dynamic manner instead of the static options ?
> If it is possible then, how can I do it ?
I don't use Choice but ComboBox and as both use the same base (i.e.
ControlWithItems/ItemContainer) you should be able to do what I do.
Most of my ComboBox's are loaded when they receive focus or when another
control changes.
I then check if what is requested to be shown is already the same as
what the control already has in its list and then do nothing, otherwise
I do:
control.Clear()
.. get the items needed from the database
control.Append('item string', db.primarykey/s)
you could also use:
control.AppendItems(listOfStrings)
Werner
P.S.
This is more a wxPython then a Boa question, so for questions like this
you are most often better of asking it on:
wxpython-users-/[email protected]
------------------------------------------------------------------------------