[wxpython-users] An event between different widgets

Gerard Petersen lijssies at gp-net.nl
Wed Apr 23 22:31:04 PDT 2008


Hi again,

Both Mark and C M a big THANX for the feedback. Worked like a charm! Also the 
explanation gave me a better understanding on what to put where. I see a big 
refactor event on the horizon .. :-)

I have one more question. On the listctrl I can do single selects without 
enabling the "wx.LC_SINGLE_SEL". I was digging in the API docs but I couldn't 
find the styles explained anywhere. Is this info to be found there or am I 
looking in the wrong place?

Thanx again guys!!

Regards,

Gerard.


On Wednesday 23 April 2008 21:14:01 C M wrote:
>
> The example given is the way to think about it.  It is not that you
> are passing the event from one widget to another; the way to think
> about it is:  you have an event from one widget.  Then, in the event
> handler for that widget, you can do anything, including mucking about
> with the state/contents of other widgets by using their (many)
> methods.  Also, you can also make the event handler simply call
> another function which really does the work.  This way, if you change
> the GUI, you still have the function, and so the GUI is separate from
> the logic.  So for the above it would be more like (realizing it was
> written just to make the point):
>
>  def OnDelButton(self, event):
>     self.delete_listctrl()
>
> def delete_listctrl(self):
>     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()
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users



-- 
My $Grtz =~ Gerard;
~
:wq!




More information about the wxpython-users mailing list