How to use Sockets with wxPython?

DH no at sp.am
Fri Mar 12 16:49:42 EST 2004


jblazi wrote:

> I am having this problem:
> I use Python for my teaching and right now we are trying to implement some
> sort of very simple graphical game the pupils can play across the
> Internet. For this, we use wxPython.
> 
> Now it has turned out that wxPython does not implement wxWidget sockets,
> so we have to use Python sockets instead. Implementing a separate thread
> for this would be too complicated and I am going to use the wxIdle event
> to do the socket processing, as the amount of data sent from one player to
> the other is very small.

You might want to use Twisted instead.  You need the very latest version 
(1.2 or later) for it to work with wxPython:
http://www.twistedmatrix.com/products/twisted

You would use Twisted's wxreactor class.  Look at the wxdemo.py file 
under site-packages/TwistedDocs/examples/


See also this tutorial (part 2 on game networking) on using Twisted with 
pygame:  http://sjbrown.ezide.com/games/writing-games.html



More information about the Python-list mailing list