> In telnet.py, socket I/O is handled via the UNIX fork command. This
> creates two processes, one reading and one writing. Now I need to
> interface this with Tk.
> Since socket.read() waits for input, I first added yet another
> process using fork. The problem: it apparently caused the creation
> of two separate widgets, one of which was displayed and was using
> mainloop(), the other of which was NOT being displayed and was used
> by the receiver process. In other words, trying to add received text
> to the Text widget didn't work.
I would use a single process and call select to figure out if there's
anything to read from the socket. I don't know tk well enough (yet)
to know if it has hooks for this, but you can always use 'after' to
have some Python function called frequently (e.g. every 10 msec).
Your Python code can then use select and decide to read from the
If it doesn't alraeady exists, it would be useful to add a hook for
this to the C interface to Tk...
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>