[wxPython] Setting ListBox selections

I still have this problem with the ListBox widget...

···

---------- Forwarded message ----------

Today's problem is this: I can't seem to preset which items
are selected on a wxListBox

--- snippet ---

self.param_list.Deselect (0)
for i in l:
  self.param_list.SetSelection (i-1)
  p = data['model']['parameters']
  s = p [i].keys()[0]
  self.param_list.SetStringSelection (s)
  print i, s # TEST

---

--- output ---

1 Parameter one
2 Parameter two

---

So why doesn't the ListBox select the appropriate items?

It has eight items in it, the first two being the same
as the strings seen in the output... but whether I try
and set the selected items by number, string, or both,
it always selects the first one (despite the deselect)
and only the first one.

Regards,
Denny

----------------------------------------------------------
Denny De La Haye \ www-edc.eng.cam.ac.uk/~djd33
Engineering Design Centre, \ www-edc.eng.cam.ac.uk
Department of Engineering, \ www.eng.cam.ac.uk
University of Cambridge, UK \ www.cam.ac.uk
----------------------------------------------------------
"The more you read, the less everyone else knows"

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

Today's problem is this: I can't seem to preset which items
are selected on a wxListBox

I'm not sure what your sample is trying to show since the tabs all got eaten
by my mail reader, but listbox.SetSelection(int) works fine for me.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users