[PyKDE] [PyQt] QProcess and reading from input
Jacek Jablonski
yacek87 at gmail.com
Fri Dec 15 21:57:17 GMT 2006
Hi!
I have some program in C++ that emits the data to stdout. And I have
some script in Python. I want this script to read the data everytime
it is available and then move the progress bar. But whole content is
read when QProcess ends. Here is code:
*****
from PyQt4 import QtCore, QtGui
class GG(QtCore.QThread):
def __init__(self, gui):
self.gui = gui
QtCore.QThread.__init__(self, gui)
QtCore.QObject.__init__(self, gui)
self.connect(self.gui.ui.sendButtonG, QtCore.SIGNAL("clicked()"), self.run)
def run(self):
self.process = QtCore.QProcess(self)
self.connect(self.process,
QtCore.SIGNAL("readyReadStandardOutput()"), self.foo)
self.process.start("./ggsend")
def foo(self):
print self.process.readAllStandardOutput()
print "in the function"
*****
so foo() is called only once, because "in the function" shows only once.
Please help,
JJ
More information about the PyQt
mailing list