python - CTRL-click behavior in wx.ListBox with multiple selections -
python - CTRL-click behavior in wx.ListBox with multiple selections -
i have wx.listbox user select if holding downwards ctrl key. - if click on item not selected, selected (without modifying other selections), , if click on selected item, deselected (again without modifying other selections).
the code create listbox is:
self.mylistbox = wx.listbox(self, -1, choices=self.keys, style = wx.lb_hscroll | wx.lb_multiple | wx.lb_needed_sb | wx.lb_sort) self.bind(wx.evt_listbox, self.onselection, self.mylistbox) problems / questions:
is there easy way this? either wx.lb_multiple or wx.lb_extended might want, i've tried both , doesn't appear alter anything. description in documentation little vague - difference between two?
i know can id of selected item event.getselection(), if seek implement above logic, i.e.:
if self.mylistbox.isselected(idx): self.mylistbox.deselect(idx) else: self.mylistbox.select(idx) the event has fired , deselects whatever selected. tried calling event.skip() before well, no luck there either. there way can stop doing that?
i noticed when dragging mouse multiple selections event.getselection() right id's going - i.e., 3, 2, 1, 0 - going downwards show first - 0, 0, 0, 0. i'm guessing it's printing out first item in list of selections -- there way list event object (as opposed calling self.mylistbox.getselections())?
i'm running linux , wxpython version 2.6.4.0.
wxpython 2.6.x super old. upgrade 2.8 or 2.9 series. ran wxpython demo 2.8.11 , seemed work fine me on windows.
python wxpython
Comments
Post a Comment