console redirection to Tkinter

J.Jacob joost_jacob at hotmail.com
Thu Apr 25 17:36:06 EDT 2002


Argh, pasted the wrong buffer, really !  The line with fout.readline()
should have fin instead of fout.
Here is the correct example:


from Tkinter import *
import popen2

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


dutch-people-would-spot-the-error-immediately-yrs



More information about the Python-list mailing list