Pyside Qprocess Need Help
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_
Solution 1:
You need to ensure that the program (gcc
in this case) runs with stdout unbuffered. Most console applications buffer unless writing to a console (cmd.exe
or terminal) since that improves performance. Presumably the internal streams used by Qt to buffer the QProcess
' output are not seen as ttys, which is why you get buffering and only see output at the end.
Normally C programs can be made to turn buffering off (setvbuf
), but most don't do this. Since you need things to work with gcc
, which presunably buffers for non-ttys, you'll have to use a utility like unbuffer
. See this answer.
Post a Comment for "Pyside Qprocess Need Help"