[wxpython-users] An event between different widgets
Mark Guagenti
mgenti at gentiweb.com
Wed Apr 23 11:20:07 PDT 2008
The easiest way to code it would be:
self.list = wx.ListCtrl(style=wx.LC_SINGLE_SEL)
self.Bind(wx.EVT_BUTTON, self.OnDelButton, delBtn)
def OnDelButton(self, event):
if self.list.SelectedItemCount > 0:
self.list.DeleteItem(self.list.GetFirstSelected())
else:
dlg = wx.MessageDialog(self, "An entry must be selected
first", "Error", style=wx.OK|wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
On Wed, Apr 23, 2008 at 12:59 PM, Gerard Petersen <lijssies at gp-net.nl> wrote:
> Hi all,
>
> I've been around wx.python for a couple of months now, and gathered quite an
> application already (mostly sorting out boxsizers ... :-)
>
> I want to be able to manage (add/remove/edit) a listctrl with seperate
> buttons. See image link: http://www.gp-net.nl/userdl/snippet1.jpg
>
> I've read a good piece on bind methods and events on the wxpywiki, but I'm a
> bit lost. When I select an entry in the list, I want to remove it with the
> button so there needs to be a function for the button-down event but
> it also is listctrl related. I don't really know where to put the method (or
> it's trigger) that actually kicks the entry from the list.
>
> Any tips, URL's with examples or code snippets are very welcome.
>
> Thanx a lot.
>
> Regards,
>
> Gerard.
>
>
> --
> ~
> ~
> :wq!
>
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
More information about the wxpython-users
mailing list