Néstor Amigo Cairo wrote:

> Ok! I have tested this, and it only works at the end of the execution
> of the command, 

There is a problem in the way you create your watcher's callback. 
You have to use a function, a method or a lambda. Try with this 
version of 'do_format'. It will also handle pipe error conditions.
#-------------------------------------------
   def do_format(self, widget, textbuffer):

     def watcher(source, condition, buf):
       if condition == gobject.IO_IN:
         buf.insert(buf.get_end_iter(), source.readline())
         return True # keep it watching
       # error condition
       buf.insert(buf.get_end_iter(), "<process died>\n")
       return False # stop watching

     proc = subprocess.Popen(("./prueba.sh"),
                             shell=False,
                             stdout=subprocess.PIPE,
                            )
     gobject.io_add_watch(proc.stdout,
                          gobject.IO_IN | gobject.IO_ERR | 
gobject.IO_HUP,
                          watcher, textbuffer)
     return
#-------------------------------------------

Hope that helps.
r.


_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to