from tkinter import tk def add(): num1=float(num1_entry.get()) num2=float(num2_entry.get()) result=num1+num2 result_label.config(text=result) #create the main window root=tk.Tk() root.title("Add Two Numbers") #create the widgets num1_label=tk.Label(root, text="Number 1:") num1_entry=tkEntry(root) num2_label=tk.Label(root, text="Number 2:") num2_entry=tkEntry(root) add_button=tk.Button(root,text="Add",command=add) result_label=tk.Label(root,text="Result:")