2

I just start learning python to work with raspberry, my ultimate goal is to make a client / server application by creating a p2p network between raspberry. I chose to use the library asyncore to make client and server and initially pygame for graphics, now I'm trying to use PySide but I have a problem.

How can I integrate the asyncore.loop() into the main loop of pyside?

4

1 回答 1

1

Have you tried this?

class ClientThread(threading.Thread):

# Start the thread for the socket
def __init__(self, server, port, user, gui):
    threading.Thread.__init__(self)
    self.client = ClientConnection(server, int(port), user, gui)

# Run the asyncore loop
def run(self):
    try:
        asyncore.loop()
    except:
        return 0

Maybe it can be usefull for you this example: https://github.com/absolution/Month-2--Chat-Client-/blob/master/ClientGUI.py

于 2013-04-21T14:49:43.327 回答