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
is a more feature-rich calculator application that includes additional functionality such as square, square root, customizable themes, and keyboard shortcuts.
- 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
- Python 3.x
- Tkinter
- ConfigParser (for theme management)
To run calculator.py
:
-
Clone the repository:
git clone https://github.com/IHEfty/Calculator.py.git
-
Navigate to the project directory:
cd Calculator.py
-
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:
sudo apt-get install python3-tk
-
For Windows: Tkinter comes pre-installed with Python.
-
-
Run the application:
python calculator.py
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.
[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.
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.
- 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
To run calc.py
:
-
Clone the repository:
git clone https://github.com/IHEfty/Calculator.py.git
-
Navigate to the project directory:
cd Calculator.py
-
Run the application:
python calc.py
- Launch the application: Run
calc.py
. - Input numbers and operations using the calculator buttons.
- Perform calculations by pressing the
=
button. - Clear or backspace using the
C
or←
buttons respectively.
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 are welcome! Please feel free to submit a pull request or open an issue to discuss any changes you'd like to make.
This project is licensed under the MIT License - see the LICENSE file for details.