printing from child process in Tkinter window
upton at virginia.edu
Fri Aug 28 01:35:04 CEST 2009
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)
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
(same for apppipe.stderr)
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list