--- Dustin Mitchell <dmmitche purdue.edu> wrote:
> The basic underlying structure of my program is like
> this. My network
> code sits in an infinite loop receiving packets.
> When a certain packet
> is received I want to trigger an event. That way
> each packet of
> interest will have it's own separate event and the
> rest of the app can
> bind to those events and respond to them. What I
> have tried to do up to
> now is create a new event handler that will be used
> for the network
> events. But I run into problems with I try and bind
> to my network event
> handler. This is the code I have so far in my
> attempt to accomplish this.
Perhaps it's just the fact that the hour's late, but I
don't understand what it is that you're bumping your
head against. If I was writing code like yours, I
would put in:
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)
Note, I haven't done any testing with the above, but I
can't see why it wouldn't work.
Gre7g
____________________________________________________________
________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.c
om/collections/265
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|