Re: [Boa Constr] Can choice control have dynamically generated options ?
Status: Beta
Brought to you by:
riaan
From: Riaan B. <riaan@e.co.za> - 2009-04-01 22:56:25
|
Hi Tanay, 2009/4/1 Tanay Shah <tan...@gm...>: > 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 ? > Thanks in advance If you mean dynamic as in values that change while your program is running, then please follow Werners instructions. If you mean dynamic as in other values than the statically defined values in the Designer then yes you can do this with a feature in Boa called special attributes. See an example in Examples/advanced/SpecialAttributes/wxFrame1.py There is also help about it on the "Working with generated source" page in the application help. In short, before the call to self._init_ctrls(...) you can define a design-time value for the parameter in the generated source followed by the run-time value which is usually set from a parameter passed to the constructor. e.g. def __init__(self, parent, myChoices): self.myChoices = ['design-time', 'choices'] self.myChoices = myChoices self._init_ctrls(parent) Now you can change the "choices" parameter of your wx.Choice to be choices=self.myChoice Cheers, Riaan. |