This project is a full-featured scientific calculator built with Python and Tkinter. It provides both basic arithmetic operations and advanced scientific functions with an elegant user interface that includes a history log and dark/light mode toggle.
- Introduction
- Features
- Technologies Used
- Installation
- Usage
- Screenshots
- Implementation Details
- Workflow Diagram
- Future Work
- Contributing
- License
This calculator application was designed to provide a comprehensive yet user-friendly tool for performing mathematical calculations. It combines the simplicity of a basic calculator with the power of scientific functions, all wrapped in a modern and customizable interface.
- Basic arithmetic operations (addition, subtraction, multiplication, division)
- Scientific functions (sin, cos, tan, log, ln, square root, powers)
- Mathematical constants (π, e)
- Interactive history log that records all calculations
- Dark/Light theme toggle for user preference
- Clean and responsive user interface
- Error handling for invalid expressions
- Keyboard input support for efficient calculations
- Python 3.13
- Tkinter (GUI library)
- Math module for scientific operations
- Object-Oriented Programming principles
To run this calculator application, ensure you have Python installed on your system:
# Clone the repository (if applicable)
git clone https://github.com/0xarchit/scientific-calculator.git
# Navigate to the project directory
cd scientific-calculator
# Run the application
python main.pyNo additional dependencies are required as Tkinter is included in standard Python installations.
- Basic Operations: Click on the digit buttons and operators to build expressions
- Scientific Functions: Use sin, cos, tan, log, etc. for advanced calculations
- History: Review past calculations in the history panel on the left
- Theme Toggle: Switch between dark and light modes using the toggle button
- Clear/Delete: Use 'C' to clear the current expression or '⌫' to delete the last character
- Keyboard Input: Use your keyboard for faster input:
- Number keys (0-9) for digits
- Standard operators (+, -, *, /)
- Enter key to evaluate expressions
- Backspace to delete last character
- Escape key to clear the expression
- Keyboard shortcuts for functions: 's' for sin, 'c' for cos, etc.
- Basic arithmetic:
5 + 7 = 12 - Using constants:
2 × π = 6.283185307179586 - Scientific functions:
sin(π/2) = 1.0 - Combined operations:
3 × (4 + 5) = 27
The calculator is implemented using object-oriented programming with the following key components:
- Main Application Class: Manages the overall application state and UI
- Display System: Shows the current expression and calculation results
- Button Grid: Organized layout for digits, operators, and functions
- Calculation Engine: Evaluates mathematical expressions safely
- History System: Records and displays calculation history
- Theme Manager: Handles switching between dark and light color schemes
- Keyboard Handler: Processes keyboard events for direct input
Below is a diagram illustrating the workflow of the calculator application:
flowchart TD
A[User Input] -->|Button Click/Keyboard Press| B[Input Handler]
B --> C{Input Type?}
C -->|Number/Operator| D[Add to Expression]
C -->|Function| E[Add Function to Expression]
C -->|Equals| F[Evaluate Expression]
C -->|Clear/Delete| G[Modify Expression]
C -->|Theme Toggle| H[Switch Theme]
D --> I[Update Display]
E --> I
F --> J[Process Calculation]
J --> K[Format Result]
K --> L[Update History]
L --> I
G --> I
H --> M[Apply Theme Settings]
M --> I
- Add memory functions (M+, M-, MR, MC)
- Implement unit conversion capabilities
- Support for more complex mathematical functions
- Ability to save calculation history to a file
- Add scientific notation support
- Implement bracket matching and syntax highlighting
- Create a mobile-friendly responsive design
Contributions to improve the calculator are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Make your changes
- Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature-branch) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.

