An open API service indexing awesome lists of open source software.

https://github.com/ihefty/calculator.py

This is a simple calculator application built using Python's Tkinter library. It supports basic arithmetic operations and provides a user-friendly graphical interface.
https://github.com/ihefty/calculator.py

calculator calculator-application calculator-python

Last synced: 9 months ago
JSON representation

This is a simple calculator application built using Python's Tkinter library. It supports basic arithmetic operations and provides a user-friendly graphical interface.

Awesome Lists containing this project

README

          

# Calculator Application

This repository contains two Python-based calculator applications, each built using the Tkinter library. Both support basic arithmetic operations and feature user-friendly graphical interfaces. Below, you'll find details about both versions: `calc.py` and `calculator.py`.

---

## `calculator.py`

![preview](./res/preview.png)

`calculator.py` is a more feature-rich calculator application that includes additional functionality such as square, square root, customizable themes, and keyboard shortcuts.

### Features

- Basic arithmetic operations: Addition, Subtraction, Multiplication, Division
- Additional functionality: Square, Square Root
- Clear and Backspace buttons
- Keyboard shortcuts for ease of use
- Customizable themes via a `theme.ini` file

### Technologies Used

- Python 3.x
- Tkinter
- ConfigParser (for theme management)

### Installation

To run `calculator.py`:

1. **Clone the repository:**
```bash
git clone https://github.com/IHEfty/Calculator.py.git
```

2. **Navigate to the project directory:**
```bash
cd Calculator.py
```

3. **Install Tkinter (if not already installed):**
Tkinter is included with most Python installations, but if it's not available, you can install it:

- **For Ubuntu:**
```bash
sudo apt-get install python3-tk
```

- **For Windows:** Tkinter comes pre-installed with Python.

4. **Run the application:**
```bash
python calculator.py
```

---

### Configuration

`calculator.py` supports customizable themes through a `theme.ini` file. You can modify the `theme_name` in the `[default]` section to change the default theme. Additional themes can be added by creating new sections in the file.

### Sample `theme.ini`

```ini
[default]
theme_name = Gray

[Classic]
OFF_WHITE = #F8FAFF
WHITE = #FFFFFF
LIGHT_BLUE = #CCEDFF
LIGHT_GRAY = #F5F5F5
LABEL_COLOR = #25265E
BUTTON_TEXT_COLOR = #25265E
BUTTON_BACKGROUND = #FFFFFF
EQUALS_BACKGROUND = #4A90E2

[Gray]
DARK_GRAY = #1E1E1E
MEDIUM_GRAY = #3C3C3C
LIGHT_GRAY = #E1E1E1
BLUE = #4A90E2
WHITE = #FFFFFF
BUTTON_TEXT_COLOR = #1E1E1E
BUTTON_BACKGROUND = #FFFFFF
EQUALS_BACKGROUND = #1E1E1E
```
For more information and details, please click [here](https://github.com/IHEfty/Calculator.py/blob/main/res/README.md).

---
## `calc.py`

![preview](./res/preview1.png)

`calc.py` is a simple calculator application with a basic design and functionality. It includes essential arithmetic operations such as addition, subtraction, multiplication, and division.

### Features

- Basic arithmetic operations: Addition, Subtraction, Multiplication, Division
- Clear input field with the 'C' button
- Backspace functionality to remove the last character
- Error handling for invalid inputs

### Installation

To run `calc.py`:

1. **Clone the repository:**
```bash
git clone https://github.com/IHEfty/Calculator.py.git
```

2. **Navigate to the project directory:**
```bash
cd Calculator.py
```

3. **Run the application:**
```bash
python calc.py
```

### How to Use

1. **Launch the application**: Run `calc.py`.
2. **Input numbers and operations** using the calculator buttons.
3. **Perform calculations** by pressing the `=` button.
4. **Clear or backspace** using the `C` or `←` buttons respectively.

## Note to CST CSE Students

This project is designed for educational purposes, especially for those new to Python and GUI development. Please use this code as a learning resource and avoid submitting it as your own work. **Creativity is an art; feel that art!**

---

## Contributions

Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss any changes you'd like to make.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.