getting a NoneType' object has no attribute 'insert' error in python when inserting text to Text widget in Tkinter [duplicate]

So, I've got my basic function that prints some data to a text file. I want to put this data into a textbox in Tkinter. The problem I'm getting is that it's saving all the data to the file, then reading it all again, but it's not inserting it into the text box. When I click Calculate (the button that triggers the function), it returns the error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__
    return self.func(*args)
  File "D:\Python Project\Roof Pitch Calculator.py", line 52, in Calculate
    ResultsBox.insert(END, contents)
AttributeError: 'NoneType' object has no attribute 'insert'

The function contains the following code:

def Calculate():
    h1 = float(LongHeight.get())
    h2 = float(ShortHeight.get())
    aj = float(Width.get())
    d = float(Depth.get())

    opc = h1 - h2
    Opc_Width = opc / aj
    Radians = math.atan(opc / aj)
    Pitch = math.degrees(math.atan(opc / aj))
    Width_And_Height_Squared = (opc * opc) + (aj * aj)
    Square_Root = math.sqrt((opc * opc) + (aj * aj))
    Roof_Area = math.sqrt((opc * opc) + (aj * aj))*d

    text_file = open("temp.txt", "a")
    text_file.write("Longest Height: ")
    text_file.write(str(h1))
    text_file.write("\n")
    text_file.write("Shortest Height: ")
    text_file.write(str(h2))
    text_file.write("\n")
    text_file.write("Width: ")
    text_file.write(str(aj))
    text_file.write("\n")
    text_file.write("Depth: ")
    text_file.write(str(d))
    text_file.write("\n")
    text_file.write("Pitch: ")
    text_file.write(str(Pitch))
    text_file.write("\n")
    text_file.write("Roof Area: ")
    text_file.write(str(Roof_Area))
    text_file.write("\n")
    text_file.write("\n")
    text_file.close()

    text_file = open("temp.txt")
    contents = ""

    for i in text_file:
        contents += i

    ResultsBox.insert(END, contents)
    text_file.close()

Also, is there a way to put data straight into a textbox, instead of into a text file, then a textbox? If so, please could someone tell me how to do it, as I couldn't figure it out for the life of me.

EDIT: Here is the full code:

from tkinter import *
from tkinter.ttk import *
import math, os

try:
    os.remove("temp.txt")
except OSError:
    pass

def Calculate():
    h1 = float(LongHeight.get())
    h2 = float(ShortHeight.get())
    aj = float(Width.get())
    d = float(Depth.get())

    opc = h1 - h2
    Opc_Width = opc / aj
    Radians = math.atan(opc / aj)
    Pitch = math.degrees(math.atan(opc / aj))
    Width_And_Height_Squared = (opc * opc) + (aj * aj)
    Square_Root = math.sqrt((opc * opc) + (aj * aj))
    Roof_Area = math.sqrt((opc * opc) + (aj * aj))*d

    text_file = open("temp.txt", "a")
    text_file.write("Longest Height: ")
    text_file.write(str(h1))
    text_file.write("\n")
    text_file.write("Shortest Height: ")
    text_file.write(str(h2))
    text_file.write("\n")
    text_file.write("Width: ")
    text_file.write(str(aj))
    text_file.write("\n")
    text_file.write("Depth: ")
    text_file.write(str(d))
    text_file.write("\n")
    text_file.write("Pitch: ")
    text_file.write(str(Pitch))
    text_file.write("\n")
    text_file.write("Roof Area: ")
    text_file.write(str(Roof_Area))
    text_file.write("\n")
    text_file.write("\n")
    text_file.close()

    text_file = open("temp.txt")
    contents = ""

    for i in text_file:
        contents += i

    ResultsBox.insert(END, contents)
    text_file.close()

    ShortHeight.set("")
    LongHeight.set("")
    Depth.set("")
    Width.set("")


window = Tk()
window.geometry("600x400+200+200")
window.title("Roof Pitch Calculator")
window.wm_resizable(0,0)

TitleLabel = Label(window, font = "Comic 30", foreground = "deep sky blue", text = "Roof Pitch Calculator").pack()

CalculateButton = Button(window, text = "Calculate", command = Calculate).pack(side = BOTTOM, pady = 5)
ResultsBox = Text(window, height = 13, width = 70).pack(side = BOTTOM)
ShortHeightLabel = Label(window, text = "Short Height").place(x = 190, y = 50)
LongHeightLabel = Label(window, text = "Long Height").place(x = 330, y = 50)
DepthLabel = Label(window, text = "Depth").place(x = 207, y = 100)
WidthLabel = Label(window, text = "Width").place(x = 345, y = 100)

ShortHeight = StringVar()
ShortHeightEntry = Entry(window, textvariable = ShortHeight)
ShortHeightEntry.place(x = 161, y = 71)

LongHeight = StringVar()
LongHeightEntry = Entry(window, textvariable = LongHeight)
LongHeightEntry.place(x = 300, y = 71)

Depth = StringVar()
DepthEntry = Entry(window, textvariable = Depth)
DepthEntry.place(x = 161, y = 120)

Width = StringVar()
WidthEntry = Entry(window, textvariable = Width)
WidthEntry.place(x = 300, y = 120)

window.mainloop()

You are assigning the result of .pack() to ResultsBox, try to do it in two lines:

ResultsBox = Text(window, height = 13, width = 70)
ResultsBox.pack(side = BOTTOM)

Also, you don't need to write a text file then reopening it to load the contents. I would use a list to store the contents, then I would use the list both for saving and filling the text box:

contents_list = ["Longest Height: ",
                 str(h1),
                 "\n",
                 ...]
contents = "".join(contents_list)
text_file.write(contents)
ResultsBox.insert(END, contents)