I'm very new to wxpython, so I'm afraid I'm likely overlooking
something very basic here. Unfourtunatly I haven't been able to
figure it out on my own. I've got a wxListBox set up to use a list
of names. And I've also a number of other controls which get the
values they display by checking the listcontroll and going the
appropriate number of places foreward in other lists.My question is how do I get these other controlls to update
themselves when someone picks a new name from the listbox? Is
there some kind of event I need to trigger when a new selection is
made in the listbox, or better is there a way that when any
control on a form is changed they'll all update themselves?
I would handle the event, and change the other controls from the
handler.
Say you want to change label of a button when the user makes a
selection. As a guideline:
listboxId = wxNewId()
# create a button
self.button = wxButton(self, -1, "Selection")
# create a list box
listbox = wxListBox(self, listboxId,
choices=["alpha","bravo","charlie"])
# attach the method self.OnSelect to the listbox
EVT_LISTBOX(self, listboxId, self.OnSelect)
def OnSelect(self, event):
# change the label on the button to be the text selected in
# the list box
self.button.SetLabel(event.GetString())
HTH,
Craig