This project is a simple and scientific calculator built using Flask and Tailwind CSS. It supports both basic and scientific operations, including addition, subtraction, multiplication, division, trigonometric functions, square root, and more. The calculator is designed with a responsive and interactive user interface.
- Basic Operations: Addition, Subtraction, Multiplication, and Division.
- Scientific Operations: Trigonometric functions (
sin
,cos
,tan
), logarithms, square roots, powers (x², x³). - Responsive Design: Built with Tailwind CSS to ensure it works well on all screen sizes.
- Smooth UI: Animations for button presses and screen transitions.
- Real-time Calculation: Calculations are done on the client-side, but the backend can be extended for more complex functionalities.
- Frontend:
- HTML
- Tailwind CSS (for styling)
- Vanilla JavaScript (for client-side logic)
- Backend:
- Python (Flask)
- Flask to serve the application
- Other:
- Tailwind CSS for utility-first styling
- JavaScript for interactivity (handling button clicks and keyboard input)
-
Clone the repository:
git clone https://github.com/yourusername/calculator-project.git
-
Install dependencies: Navigate to the project directory and install the required Python packages:
cd calculator-project pip install -r requirements.txt
-
Run the Flask app: Run the Flask development server to start the application:
python app.py
-
Open in Browser: Open your browser and go to
http://127.0.0.1:5000/
to use the calculator.
Once the app is running, you can:
- Click on the buttons: Use the mouse to click on the calculator buttons to perform operations.
- Keyboard Input: You can also use the keyboard for input. Here are the key mappings:
- Number keys (0-9): Input digits.
+
,-
,*
,/
: Perform arithmetic operations.Enter
: Calculate the result.Backspace
: Delete the last character.Escape
: Clear the display.(
,)
: Parentheses for grouping.%
: Percentage operation.- Trigonometric functions:
sin
,cos
,tan
,log
, and others.
- The backend is built with Flask, and it handles complex calculations like square roots, powers, and trigonometric functions using Python libraries.
- The front-end uses JavaScript to handle user input, interact with the Flask API, and update the display dynamically.
- Fork the repository.
- Create a new branch (
git checkout -b feature-name
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-name
). - Create a new pull request.
- The design uses Tailwind CSS for styling.
- The scientific calculator features are powered by simple JavaScript functions and Python's
math
module. - Special thanks to the Unsplash API for providing the background images.
- Add more advanced scientific operations (e.g., integration, derivatives).
- Implement server-side calculations for more complex operations.
- Add user authentication and save history of calculations for each user.