A modern, dark-themed calculator built with Python 3 and Tkinter. This first version focuses on a clean, functional UI for basic arithmetic operations.
- Dark Modern UI: Aesthetic and easy on the eyes.
- Intuitive Design: Large display area and bold, easy-to-press buttons.
- Core Arithmetic: Supports
+,-,Γ,Γ·, and decimals (.). - Utility Functions: Dedicated Clear (C) and Backspace (D) buttons.
- Robust Layout: Fully responsive grid layout, providing perfect alignment.
- Stability: Built-in basic error handling to manage invalid expressions.
- Fixed Size: Non-resizable window for consistent UI integrity.
To run this project locally, follow these simple steps:
You need Python 3.x installed. Tkinter is typically included with standard Python installations.
-
Clone the repository:
git clone https://github.com/shanuz123/calculator-python.git
-
Navigate into the project folder:
cd calculator-python -
Run the program:
python 'Calculator Project.py'
The application relies on standard Python practices for GUI development and calculation:
- UI Management: The Tkinter library is used exclusively for creating the window, display, and buttons.
- Expression Handling: A
StringVaris used to dynamically store and update the current mathematical expression displayed in the Entry widget. - Calculation: The built-in
eval()function is used to securely evaluate the string expression within a robusttry/exceptblock for error handling. - Layout: The
grid()geometry manager is utilized to create a clean, organized, and perfectly aligned button layout. - Styling: Buttons are managed using distinct style configurations for normal numbers, operators, and utility functions (Clear, Backspace, Evaluate).
| Technology | Type |
|---|---|
| Python | Primary Language |
| Tkinter | GUI Library (Built-in) |
- Implement numerical key input (0-9).
- Map
Enterkey to the Evaluate (=) function. - Map
Backspacekey to the Delete/Backspace (D) function. - Map
ESCkey to the Clear (C) function. - Full support for
+,-,*,/, and.keys.
- Add a dedicated % button.
- Implement common percentage math (e.g.,
50%=0.5,200 + 10%=220).
- V4: Theme Toggle (Light/Dark themes).
- V5: History Panel (Sidebar/popup for previous calculations).
- V6: Hover Effects (On-hover color changes with smooth transitions).
- V7: Sound Effects (Click sounds with toggle option).
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'feat: Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Shanavas Shafi
- Python & Cybersecurity Learner
- GitHub: (https://github.com/shanuz123)
