[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame and dualhead displays?



Kris Schnee wrote:
Ryan Charpentier wrote:
This is entirely doable if you use two or more processes, each running a pygame screen. Then just pass messages between them using sockets.

I was about to suggest writing little files to some directory and having two Pygame instances read them to communicate. Sockets sound more elegant; how would you open a connection between two processes running locally, though? I've tried running a MUCK server program and then having a homemade MUCK client connect to 127.0.0.1; would it work to have one Pygame instance listen and one send at that address?
Yeah, it would work.
I don't know if you could send and receive from both machines on a single port,
but yeah, you could do it.
Yeah, you just point it to 127.0.0.1, or you type 'localhost' as the ip when you're declaring the socket.
Something like


from socket import *
s = socket(AF_INET,SOCK_DGRAM)
s.bind(('localhost',1234))

should accomplish this.