If you really need to get the output from stdout
, then you probably need to temporarily redirect it. See: Can I redirect the stdout in python into some sort of string buffer?
Then, once you have that output in a string , it should be straightforward to create a frame with it:
from ScrolledText import ScrolledText
import Tkinter as tk
class OutputViewer(tk.Frame):
def __init__(self, data, master=None):
tk.Frame.__init__(self, master)
self.text = ScrolledText(self, width=90, height=13)
self.text.pack()
self.text.insert(tk.END, data)
self.text.see(tk.END)
Hope that helps.