--- Gre7g Luterman <hafeliel yahoo.com> wrote:
> class NetworkEvent(wx.PyCommandEvent):
> Type = wx.NewEventType()
> def __init__(self):
> wx.PyCommandEvent.__init__(self, self.Type,
> -1)
> EVT_NETWORK_EVENT =
> wx.PyEventBinder(NetworkEvent.Type, 1)
>
> and then subclass it for each individual event I
> needed to deal with, such as:
>
> class ErrPcktEvent(NetworkEvent):
> def __init__(self, Msg):
> self.Msg = Msg
> NetworkEvent.__init__(self, self.Type, -1)
> EVT_ERR_PCKT_EVENT =
> wx.PyEventBinder(ErrPcktEvent.Type, 1)
Oh, I should have mentioned that this child class uses
the same event type as the parent. I did that so that
you could make one handler that catches all network
events. The downside of that is that each handler
that DIDN'T want every event would need a:
Event.Skip()
if not isinstance(Event, DesiredEventClass):
return
in their event handler. If you didn't want one
handler capable of catching all types of events, then
you'd want to put a:
Type = wx.NewEventType()
in each child event definition as well as the parent.
Gre7g
____________________________________________________________
________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now
(it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyh
erenow
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|