Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > Python
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Python section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2011, 12:43 AM
Registered User
 
Join Date: Mar 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default PySide QProcess, Need Help

Hi

__NOTE__: class MyWindow(QWidget):

In __init__
Code:
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:
Code:
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









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.