wxPython & asynchronous i/o

David Bolen db3l at fitlinxx.com
Tue Nov 13 20:52:13 CET 2001


bernard <bhayes at advaoptical.de> writes:

> I'm thinking of using wxPython in an app that requires the use of sockets.
> 
> Is there any way to handle socket events via the wxPython mainloop
> or to use a select loop to 'implement' the wxPython mainloop - or am I on 
> the wrong track altogether ?

The pure wxWindows way to do it with the event loop would be to use
wxSockets, which generate appropriate events on I/O.  However, I don't
believe that wxSockets are wrapped by wxPython yet.

Personally, I'd just spin off a background thread to handle your
socket I/O, and post your own events to your GUI when you needed to do
something with the data with respect to the UI.  Then you could have a
normal select loop or even blocking I/O in that background thread.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list