View Single Post
Posts: 6 | Thanked: 3 times | Joined on May 2010
#2
Originally Posted by techdork View Post
Is there any way to get a QTextBrowser to append lines read from stdout in real time?

Example (doesn't work)

Code:
proc = subprocess.Popen('/home/user/test.sh',
                               shell=True,
                               stdout=subprocess.PIPE,
                               )
for line in iter(proc.stdout.readline,''):
    self.displaybox.append(line)
    print line
One way to do this is to call the application's processEvents() method every so often. You could try calling it after you read each line, though it might be a bit inefficient to do so. The global QApplication instance is available as the qApp object, or you can obtain it using QApplication.instance().
 

The Following User Says Thank You to :-) For This Useful Post: