signals and thread communication
I am writing a graphical interface with Tkinter that prints on a text zone the results of another script that is quite long and tales some time.
The problem is that if I use popen4 I don't know when something was written and I only get te results at the end, at that point it is useless to have control text being printed.
I would like to use spawn but I don't know how to make two processes communicated (the child process sends a signal to say that he sends something in a pipe, and then the parent process reads the pipe).
Could you help me out here, please? If you have any ideas of how to do it differently, I'm open too...
My preference would be to re-write the results generating script to optionally direct it's output to a socket (UDP) and and have your Tkinter app read the socket on a loop using the after method. That way neither app should lock the other.
I've not used pipes under Linux but I did simulate it with files under Windows - not very nice.
You can still use the popen module (my preference is the popen2.popen4 class as it wraps thing nicely) to launch the results-app and use it to monitor the process id for application termination.
Last edited by Grim Archon; June 7th, 2004 at 12:42 PM.
I didn't know about sockets before, it's great!