Python and Sockets,

Chris Liechti cliechti at
Thu Aug 1 01:04:07 CEST 2002

John J Breen <jbreen at> wrote in 
news:3D486809.6F2DC882 at
>     Hey all,
>             I am writing a program in Pygtk that also has a Python/TK
> component. I need these two components to be able to communicate with
> one another through a third component written in python. I would like to
> use sockets to send information back and forth, but am running into some
> trouble. The components may be sending information at any time so I need
> to the sockets to be able to listen/send at any time. I cant have a loop
> for listening because that would keep the user from sending events to
> either the gtk or TK interface. Someone suggested _createfilehandler but
> Im not sure what that is... Does anyone have any suggestions for such a
> problem?

you'll probably want to look at the threading module. to learn about 
threads, you can look at the slides on Aahz page:

whith threads you can have a loop in one thread and the other is still 
serving the GUI. you might want to look at the Queue module too, as it 
provides an easy solution to savely pass data from one thread to an other.
(from the comm thread to the GUI and back)


Chris <cliechti at>

More information about the Python-list mailing list