FAQ
Hi all,

I've been messing with this for a couple hours now but can't make it work.
Basically I have a Tkinter GUI that creates a child process via
subprocess.Popen, and I would like to capture the child process's output to
display it in a Text widget in the GUI. Relevant snippets:

def click_start: #launch from clicking a button in the gui
...
self.apppipe = Popen(cmdString, shell=True, stdout=PIPE, stderr=PIPE)
self.master.after(200, self.readAppStdout)
...

def readAppStdout(self):
readers, writers, exceptionals = select.select( [self.apppipe.stdout],
[], [], 0.001)
if readers != []:
pipetext = self.apppipe.stdout.readline()
self.appoutput.insert(END, pipetext) #self.appoutput is the Text
widget

(same for apppipe.stderr)
self.master.after(200, self.readAppStdout)

I don't ever get any output in my window, even though I've waited long
enough that the application would otherwise have printed to the console
(based on its graphical outputs). Any suggestions for what I'm doing wrong?

-dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090827/22990893/attachment.htm>

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedAug 27, '09 at 11:35p
activeAug 27, '09 at 11:35p
posts1
users1
websitepython.org

1 user in discussion

Dan Upton: 1 post

People

Translate

site design / logo © 2022 Grokbase