subprocess.Popen() redirecting to TKinter or WXPython textwidget???
stewart.midwinter at gmail.com
stewart.midwinter at gmail.com
Wed Jan 26 16:36:11 EST 2005
Ivo, my initial thought would be, you need to know how much text you
will get back from popen. My Python reference has the following
example:
import os
dir = os.popen('ls -al', 'r')
while (1):
line = dir.readline()
if line:
print line,
else:
break
that example shows how to capture the process output in a file-type
object, then bring it into a string with readline().
in your app, you could create a Tkinter stringVar, say myOutput, for
the process output. In your Tkinter widget, you could then set a
textvariable=myOutput. also use the wait_variable and watch options
(hope I recall these correctly, don't have my Tkinter ref. at hand) to
detect when there's been a change to the contents of the StringVar and
update the contents of the label.
Hope this helps, if not, write back.
cheers
S
More information about the Python-list
mailing list