import tkinter as tk window = tk.Tk() title = tk.Label(text="CALCULATOR", background="blue", foreground="white", width="50") title.pack() descriptionText = tk.Label(text="Number 1:", background="white", foreground="black", width="50") descriptionText.pack() num1 = tk.Entry(fg="black", bg="white", width=50) num1.pack() descriptionText = tk.Label(text="Number 2:", background="white", foreground="black", width="50") descriptionText.pack() num2 = tk.Entry(fg="black", bg="white", width=50) num2.pack() resultText = tk.Label(text="The result is: ...", background="white", foreground="black", width="50") resultText.pack() def addButtonPressed(event): result = int(num1.get()) + int(num2.get()) resultText.config(text = "The result is: " + str(result)) def subtractButtonPressed(event): result = int(num1.get()) - int(num2.get()) resultText.config(text = "The result is: " + str(result)) def multiplyButtonPressed(event): result = int(num1.get()) * int(num2.get()) resultText.config(text = "The result is: " + str(result)) def divideButtonPressed(event): result = int(num1.get()) / int(num2.get()) resultText.config(text = "The result is: " + str(result)) addButton = tk.Button( text="+", width=10, height=2, bg="blue", fg="yellow", ) addButton.pack(side=tk.LEFT) addButton.bind("", addButtonPressed) subtractButton = tk.Button( text="-", width=10, height=2, bg="blue", fg="yellow", ) subtractButton.pack(side=tk.LEFT) subtractButton.bind("", subtractButtonPressed) multiplyButton = tk.Button( text="*", width=10, height=2, bg="blue", fg="yellow", ) multiplyButton.pack(side=tk.LEFT) multiplyButton.bind("", multiplyButtonPressed) divideButton = tk.Button( text="/", width=10, height=2, bg="blue", fg="yellow", ) divideButton.pack(side=tk.LEFT) divideButton.bind("", divideButtonPressed) window.mainloop()