How it works...

In the ClientThread class, the run function is overridden. In the run function, each client waits for data received from the server and displays that data in the Text Edit widget. A window class object is passed to the ServerThread class, which passes that object to ClientThread, which, in turn, uses it to access the content written in the Line Edit element.

The received data is decoded because the data received is in the form of bytes, which have to be converted into strings using UTF-8 encoding.

The demoClient.py file that we generated in the preceding section needs to be treated as a header file and needs to be imported into another Python file that will use the GUI of the header file and transmit data from the client to ...

Get Python GUI Programming - A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.