> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Mike Eve > Sent: Sunday, December 05, 2004 6:21 PM > To: [EMAIL PROTECTED] > Subject: [Tutor] Socket events and wxPython events?
Hey Mike, <snipped intro about tying GUI-network code together> > I'm thinking about 3 approaches, but rather than beat my head > against the wall, I was hoping to find out if any of these > are workable: Here are my thoughts. You might have better luck on the wxPython users mailing list if this doesn't help point you in the right direction. > 1) use sockets lib. Do socket send/recv generate any kind of > event with an event id that can used with the wxPython window > events? That is, I want to just sit and receive events such > as OnPaint, OnButton, in the same loop as I receive > "OnReceiveSocket" (or whatever it might be called). Python sockets are pretty basic, and do not tie in to wxPython as far as I know. > 2) create a separate thread which does a select then sends a > wxPython compatible event which can be intermixed with > OnPaint, etc (similar to option 1) This sounds doable - maybe combined with option 1 or 3. > 3) use SocketServer. I noticed the SocketServer class refers > to "request handler class" and "handle" functions. Do these > generate any events which are wxPython compatible By default, SocketServer will probably not interface with wxPython as far as generating events goes. > You probably noticed I'm a little confused about what a > wxPython compatible event is. I'm not sure if these events > and their event handling are part of Python or something > added by and unique to wxPython. wxPython provides the event processing framework. Using any of these approaches, it sounds like you want to create a custom event and have your network portion of the code fire that event. Check out the PythonEvents demo in the wxPython demo to see some sample code implementing a custom event. > Thanks, Mike > HTH, Christian http://www.dowski.com _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor