Skip to content

This is a simple GUI-based calculator built using Python and Tkinter. The project follows a **component-based structure**, making it easy to manage and extend.

License

Notifications You must be signed in to change notification settings

PariCoderDeveloper/Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Python Tkinter Calculator

A simple GUI calculator built using Python and Tkinter.

Overview

This project is a basic calculator implemented with Python's Tkinter module. It supports basic arithmetic operations like addition, subtraction, multiplication, and division. The calculator also features a clear button to reset the input and basic error handling for invalid operations (e.g., division by zero).

Repository Structure

.
├── main.py
└── Components
    ├── Calculator_Entry.py
    └── Calculator_Button.py
  • main.py: The main entry point that sets up the main window and integrates all components.
  • Components/Calculator_Entry.py: Contains the definition of the Entry widget for user input and result display.
  • Components/Calculator_Button.py: Contains the CalculatorButtons class that creates the calculator buttons and defines their functionality.

Features

  • GUI-based Calculator: Built using Tkinter for a graphical user interface.
  • Basic Arithmetic Operations: Supports addition (+), subtraction (-), multiplication (*), and division (/).
  • Clear Functionality: A "CL" button to clear the current input.
  • Error Handling: Displays "Error" when encountering division by zero or invalid input.
  • Responsive Layout: Utilizes Tkinter's grid layout for a clean, organized interface.

Installation

Prerequisites

  • Python 3.x installed on your system.
  • Git (to clone the repository).

Steps

  1. Clone the repository:

    git clone https://github.com/ParisaAlizadeh2003/calculator.git
    cd calculator
  2. (Optional) Create and activate a virtual environment:

    python -m venv venv
    # On Windows:
    venv\Scripts\activate
    # On Unix or MacOS:
    source venv/bin/activate
  3. Run the application:

    python main.py

Usage

  • Launch the Calculator: Run main.py to start the application.
  • Input Numbers and Operations: Use the on-screen buttons to enter numbers and arithmetic operators.
  • Compute the Result: Press the = button to evaluate the expression and display the result.
  • Clear Input: Press the CL button to clear the current input.
  • Error Handling: If an error occurs (e.g., division by zero), the calculator displays "Error".

Future Improvements

  • Enhanced UI/UX: Improve the design and layout with more advanced styling.
  • Keyboard Support: Allow users to input numbers and operations via the keyboard.
  • Additional Features: Support for advanced mathematical functions like square roots, percentages, etc.
  • Calculation History: Implement a feature to display past calculations.

Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.

License

This project is open-sourced under the MIT License.

About

This is a simple GUI-based calculator built using Python and Tkinter. The project follows a **component-based structure**, making it easy to manage and extend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages