[wxpython-users] wxListBox and non-selectable item

Raffaello Barella barbarossa.platz at gmail.com
Mon Mar 24 11:45:17 PDT 2008


Possible. You declare at the beginning of the frame class a general
variable:
FormerSelection =3D wx.NOT_FOUND

Intercept  in __init__ the event wx.EVT_LISTBOX with the code:
          myListBox.Bind(wx.EVT_LISTBOX, self OnEVT_LISTBOX)

Then you add:

      def OnEVT_LISTBOX(self, event):
          if event.GetSelection() =3D=3D non-selectable: # the int index of=
 the
forbidden item
               myListBox.SetSelection(self.FormerSelection)
          else:
               self.FormerSelection =3D event.GetSelection()
               event.Skip()


*
*
2008/3/24, Martin Landa <landa.martin at gmail.com>:
>
> Hi all,
>
> sorry for a newbie question, is there a way how to make item in
> wxListBox non-selectable, to disable an item? I checked
> SetItemState(), but I haven't found how this could be implemented.
>
> Thanks in advance! Martin
>
>
> --
> Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200803=
24/dd866731/attachment.htm


More information about the wxpython-users mailing list