A simple graphical calculator application built with Python and Tkinter.
This is a desktop calculator application with a user-friendly GUI that allows you to perform basic arithmetic operations. It features a clean interface with buttons for digits, operators, and functions.
- Number Buttons: Buttons for digits 0-9 to enter numbers
- Arithmetic Operations: Support for addition (+), subtraction (-), multiplication (*), and division (/)
- Clear Button: Clear the display with the "C" button
- Equals Button: Calculate the result of your expression
- Keyboard Support: Press Enter to calculate the result
- Error Handling: Displays "Error" if an invalid expression is entered
- Python 3.x
- Tkinter (usually included with Python)
- Clone or download this repository
- Ensure Python 3.x is installed on your system
- Tkinter should be included with your Python installation
-
Run the calculator:
python Calculator.py -
Use the buttons to enter numbers and operators
-
Click the "=" button or press Enter to calculate the result
-
Click "C" to clear the display
- GUI Layout: The calculator uses Tkinter to create a grid-based button layout with a text entry field at the top
- Calculation: The
calculate()method uses Python'seval()function to evaluate mathematical expressions - Error Handling: If an invalid expression is entered, the calculator displays "Error"
| 1 | 2 | 3 | + |
| 4 | 5 | 6 | - |
| 7 | 8 | 9 | * |
| C | 0 | = | / |
- Click buttons: 5 + 3
- Click "=" or press Enter
- Result: 8
This project is open source and available for personal and educational use.