caculator using Applet
import tkinter as tk from tkinter import messagebox def evaluate_expression(): try: result = str(eval(entry_var.get())) entry_var.set(result) except Exception: messagebox.showerror("Error", "Invalid Input") entry_var.set("") def clear_entry(): entry_var.set("") def append_to_entry(value): entry_var.set(entry_var.get() + value) root = tk.Tk() root.title("Simple Calculator") grid_layout = [ ("7", "8", "9", "/"), ("4", "5", "6", "*"), ("1", "2", "3", "-"), ("0", ".", "=", "+"), ("C",) ] entry_var = tk.StringVar() entry = tk.Entry(root, textvariable=entry_var, font=("Arial", 18), justify='right', bd=10, relief=tk.GROOVE) entry.grid(row=0, column=0, columnspan=4, sticky="nsew...