Calculator

The project to create a calculator in Python with Tkinter is a demonstration of my desire to strengthen my programming skills. This personal initiative aims to design a functional calculator with an intuitive user interface, allowing users to perform basic mathematical operations in a simple and efficient way. This project is an opportunity for me to apply my knowledge in Python programming and to become more familiar with the creation of graphical interfaces. To achieve this goal, the development process of the calculator is divided into four key stages, from initial design to final optimization. Each of these stages is essential to create a complete and useful calculator that can be used for both personal and continuous learning purposes.

Design and Environment Setup:

In this project to create a calculator in Python with Tkinter, I started by designing and planning the basic features of the calculator. My goal was to allow users to perform simple mathematical operations such as addition, subtraction, multiplication, and division. I decided to use the Tkinter module to create a graphical user interface. After carefully planning the user interface, I set up the development environment by importing Tkinter and creating a window to display the calculator.

Image of the first part of the code

User Interface and Basic Operations:

To provide a user-friendly experience, I developed a user interface with a dedicated input field for numbers and results, accompanied by buttons for numbers 0 to 9 and common mathematical operations (+, -, *, /). To ensure intuitive use, I implemented specific Python functions. These functions are responsible for performing basic operations, such as addition, subtraction, multiplication, and division, based on the data entered by the user.

Image of the code part for buttons

User Input Management and Results Display

When implementing numeric buttons, the `button_Click` function was created to capture user inputs and display them in the input field. For a better experience, I also integrated the `C` function to easily clear the screen. To perform calculations, I developed specific functions such as ` addition`, `Subtraction`, `Multiplication`, and `Division`. These functions are designed to store the first entered number as well as the ongoing mathematical operation. Finally, the `Equal` function was implemented to calculate the final result based on the selected operation and then display the result to the user. This approach ensures a smooth and intuitive use of the calculator, allowing users to perform mathematical operations in a simple and efficient manner.

Image of the code part for definitions

Optimization, Debugging, and Future Perspectives:

Although my calculator works, I see opportunities for improvement. I could handle errors, such as division by zero, and support decimals for increased precision. Regarding the user interface, I could make it more seamless by adding features such as deleting a digit during input. Detailed documentation on its use would be beneficial, and if I decide to distribute it, creating an executable or package would simplify the installation process for users. In summary, these adjustments would make my calculator more comprehensive and user-friendly.
And here is my calculator in version html, Js, and CSS.

Image of potential future code

Contact Me

anthime.lemagnen@epfedu.fr

06 24 86 91 35

Download my CV

Copyright © Anthime LEMAGNEN. Made by Anthime LEMAGNEN