[pygtk] Updating a TextBuffer line by line
Daniel Roesler
diafygi at gmail.com
Fri Jan 23 03:25:27 WST 2009
Howdy again,
I am running into a problem displaying stdout from a subprocess
command. I have a loop that checks to see if the subprocess is still
active, then reads a line in from stdout and sends it to the text
buffer. However, I can't seem to get my text buffer to print except
when the command ends. Obviously, I'm missing some logic behind how
loops work with pygtk.
Here's my code:
---------------------------
command = subprocess.Popen(cmd, stdout=subprocess.PIPE)
while command.poll() is None:
line = command.stdout.readline()
self.txtbuffer.insert_at_cursor(line)
---------------------------
Any ideas on how to read stdout line by line with subprocesses?
Avast!
Daniel Roesler
diafygi at gmail.com
More information about the pygtk
mailing list