#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    21
    Rep Power
    0

    signals and thread communication


    Hi,

    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...

    thanks,
    erwin
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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.

    grim
    Last edited by Grim Archon; June 7th, 2004 at 01:42 PM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    21
    Rep Power
    0
    Thanks!

    I didn't know about sockets before, it's great!
    erwin

IMN logo majestic logo threadwatch logo seochat tools logo