from Tkinter import *
from tkMessageBox import *
from math import *

def show_result():
    showinfo(message="Your expression: " + input.get() +
          "\nevaluates to: " + str(eval(input.get())))

root = Tk()
input = StringVar()

# make widgets
prompt = Label(root, text="Enter a mathematical expression: ")
input_entry = Entry(root, textvar=input)
eval_button = Button(root, text="Evaluate", command=show_result)
quit_button = Button(root, text="QUIT", fg="red", command=root.quit)

# add widgets
prompt.grid(row=0)
input_entry.grid(row=0,column=1)
eval_button.grid(row=0,column=2)
quit_button.grid(row=0,column=3)

root.mainloop()
