NOTE: class MyWindow(QWidget):
In init
self.proc = QtCore.QProcess(self)
self.te = QTextEdit(self)
self.btn = QPushButton("Execute", self)
self.btn.clicked.connect(self.__event_btn)
Now I have this:
def __event_btn(self):
w_dir = "" # This set to my working directory where my C files are
args = ["-o", "MyFile", "MyFile.c"]
cmd = "gcc"
self.proc.setWorkingDirectory(dir)
self.proc.readyReadStandardOutput.connect(self.__read)
self.proc.closeWriteChannel()
self.proc.setReadChannel(QtCore.QProcess.StanfardOutput())
self.proc.start(cmd, args)
def __read(self):
self.te.setText(self.proc.readAllStandardOutput)
The code above won't show anything until the process done executing.
Now my question is, is there any way that I can capture the output from gcc and show them in TextEdit by not waiting for the process to be finished? (The way that cmd.exe or teminal does. They show the output as the program runs)
Thanks
-- Mark