console redirection to Tkinter

J.Jacob joost_jacob at hotmail.com
Thu Apr 25 17:28:55 EDT 2002


Here is an example using popen2.  The echo command comes with Windows and linux.


from Tkinter import *
import popen2, sys

cmd = "echo 'hello world'"
fin, fout, ferr = popen2.popen3(cmd)
root = Tk()
t = Text(root)
t.insert('1.0', fout.readline()) 
t.pack()
root.mainloop()



More information about the Python-list mailing list