A simple and functional Desktop Calculator built using Python's built-in Tkinter library. This project performs basic arithmetic operations through an interactive GUI (Graphical User Interface) window — no browser or web server needed!
- Addition ➕
- Subtraction ➖
- Multiplication ✖️
- Division ➗
- Backspace button (
<-) — delete last entered digit - Clear Everything button (
CE) — reset the display
| Library | Purpose |
|---|---|
tkinter |
Built-in Python library for creating the GUI window, buttons & entry box |
No external libraries needed —
tkintercomes pre-installed with Python! ✅
Calculator-Using-Tkinter/
│
├── CALCULATOR USING TKINTER.py ← Main Python script
├── README.md ← Project documentation
└── calculator_screenshot.png
python --versionpython calculator.pyStep 1 → User enters first number using number buttons (0-9)
Step 2 → User clicks an operator button (+, -, x, %)
→ First number is stored
→ Display is cleared for second number
Step 3 → User enters second number
Step 4 → User clicks = button
→ Calculation is performed
→ Result is displayed
| Function | What it does |
|---|---|
click(num) |
Appends clicked number to the display |
add() |
Stores first number & sets operation to addition |
sub() |
Stores first number & sets operation to subtraction |
mult() |
Stores first number & sets operation to multiplication |
div() |
Stores first number & sets operation to division |
equal() |
Reads second number, performs operation & shows result |
back() |
Deletes last digit from display |
clear() |
Clears entire display |
tkinter— GUI window creationEntrywidget — display box for numbersButtonwidget — number & operator buttonsglobalvariables — storing first number & operation typelambdafunctions — passing arguments to button commandsif / eliflogic — selecting correct math operation