Hi John,
Is there a way to get the text of the options chosen in a
MultiChoiceDialog? I know that GetSelections() returns the indices, but
I don't know if this will help me.
Yes, it can. MultiChoiceDialog is usually shown using ShowModal(), and
this method is usually called right after the dialog creation. So, you
may want to do exactly as in the wxPython demo:
lst = [ 'apple', 'pear', 'banana', 'coconut', 'orange',
'grape', 'pineapple',
'blueberry', 'raspberry', 'blackberry', 'snozzleberry',
'etc', 'etc..', 'etc...' ]
dlg = wx.MultiChoiceDialog( self,
"Pick some fruit from\nthis list",
"wx.MultiChoiceDialog", lst)
if (dlg.ShowModal() == wx.ID_OK):
selections = dlg.GetSelections()
strings = [lst for x in selections]
self.log.write("Selections: %s -> %s\n" % (selections, strings))
You don't keep any reference to the list of strings in the dialog,
because the variable "lst" is deleted (GC collected) when your methods
returns. I don't see any appealing reason to create a dialog inside
one method and call its ShowModal inside another method, so you don't
need to save a reference for the list of strings in the dialog.
Otherwise, you could try the "GetChildren" approach I outlined in a
previous post regarding TextEntryDialog.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/