help with getting selection from wxChoice with out after it has changed
Peter Otten
__peter__ at web.de
Tue Mar 29 05:15:21 EST 2005
[..join(['fred','dixon'] wrote:
> I want to get the selection of several wxChoice boxes.
> But i do not want to have to catch the events for all the boxes
> I should be able to access the current selection outside of an
> event,but i am not seeing how to do this.
> # def EvtChoice(self, event):
> # print('EvtChoice: %s\n' % event.GetString())
> # self.ch.Append("A new item")
> #
> ##-----changed here --------- from event.GetSelection()
> # if self.ch.GetSelection() == 'one':
> # print('Well done!\n')
Perhaps you are confused by the fact that GetSelection() returns an integer?
Changing the above to either
if self.ch.GetStringSelection() == 'one':
print 'Well done!'
or
if self.ch.GetSelection() == 1:
print 'Well done, too!'
should work as you expect then.
Peter
More information about the Python-list
mailing list