Printing the output of a script to a window in python

Solution 1:

Instead of using print like you would normally use to display results to the console you can use insert() on your text box.

EDIT:

First change:

area = Text(self)
area.grid(row=2, column=1, columnspan=2, rowspan=4, 
            padx=5, sticky=E+W+S+N)

To:

self.area = Text(self)
self.area.grid(row=2, column=1, columnspan=2, rowspan=4, 
            padx=5, sticky=E+W+S+N)

This way your text box is set up as a class attribute that we can use.

Then use:

self.area.delete(1.0, "end") # to clear text box 
self.area.insert("end", your_output variable or string) # to insert content