from Tkinter import *

def convert():
    dval = (inVal.get()-32)*5.0/9.0
    celsiusValueLabel.configure(text = str(dval))

root = Tk()
inVal = DoubleVar(value=32.0) # initialise to 32F -> 0C

# create and position widgets
fahrenheitLabel = Label(root, text="Fahrenheit")
fahrenheitLabel.grid(row=0, column=0)
celsiusLabel = Label(root, text="Celsius", width=20)
celsiusLabel.grid(row=0, column=1)
fahrenheitEntry = Entry(root, textvariable=inVal)
fahrenheitEntry.grid(row=1, column=0)
celsiusValueLabel = Label(root, text="0.0", width=20)
celsiusValueLabel.grid(row=1, column=1)
convertButton = Button(root, text="Convert", command=convert)
convertButton.grid(row=2, column=0)
quitButton = Button(root, text="Quit", command=root.quit)
quitButton.grid(row=2, column=1)

root.mainloop()
