On Tue, 2002-09-10 at 00:20, Christian Reis wrote:

> You might want to look at gtk.input_add() and friends, which IIRC does
> what you want. I think I learned how to use it reading the GTK+
> tutorial, and if you do have a minute, write a simple example back and
> I'll add it to the FAQ.

What I have done so far is this:

args = (('', 48002), BHH_Communication.BHH_Request, self)
self.server = None
self.tserver = thread.start_new_thread(BHH_Communication.BHH_TCPServer,
args)

while (self.server == None):
        pass

which runs a subclass of SocketServer:

class BHH_TCPServer(SocketServer.TCPServer):
        def __init__(self, server_address, RequestHandlerClass, parent):
                SocketServer.TCPServer.__init__(self, server_address,
RequestHandlerClass)
                self.parent = parent
                self.parent.server = self
                self.in_comms = []
                self.in_comms.append(self)
                self.out_comms = []

                while 1:
                        rtoread, rtowrite, err = select.select(self.in_comms, 
self.out_comms,
[], 5.0)
                        if (len(rtoread) != 0):
                                rtoread[0].handle_request()


so I can now do things like  x = self.parent.get_some_thing() and
self.parent.do_something() from the thread in response to incoming
requests on the socket.

It's ok, but I am not sure if this can lead to problems with the thread
calling something in the main app while the main app is also playing
with the function or variable.

Any one know how these will interact?  Or better methods of inter app
communication?  

What I am trying to do is get several apps to talk to each other while
interacting with there users, these apps might be running on the same
machine (via an ltsp setup) or other machines on the local network.  

I don't expect it to be run over the internet.

-- 

*
*  Rob Brown-Bayliss
*
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to