Header Ads

Header ADS

Mini - calculator using Python

      How to make a mini-calculator using python and Tkinter

One of the basic project on python is making a mini-calculator. which performs some basic operations  like addition,subtraction, multiplication and division.


The GUl of the  Calculator ::

full code link is below::::

Every one can easily create a calculator in python by  writing some lines of codes,but the real chalenge is to add GUI (Graphical User Interface) to it.

After 3 projects on mini-calculator  i make a complete and nicely working calculator using python.

The calculator is made in just 45 lines of codes.
I also use the concept oops , while coding it.

as like my previous and  all projects i use Tkinter for making it .

Tkinter is a built in library it comes with python by default.


Working clip of the calculator :::::

Working of code :::

the code starts with importing Tkinter library
>>> from tkinter import *

after importing tkinter library , a class name " calc " is made , the class calc contains all the functions
which were used while processing the expression .

the calc class contains a constructor , BtnClick , equal and clear functions.
each function have different roles.

. constructor is used for the making the Main-frame of the Calculator
. BtnClick is used for checking which button is clicked and it append clicked button value
  at the Entry box .
.  equal function is used when the user inserts all the expression and wants the result.
equal function cantains a bulit-in function named " eval() " which solves the expression passed into it.

[ eval() function takes the expression in string format and it pass the result in int format. ]

. clear function is used to clear all the values , present in the Enter box .

I used for loop for making the buttons for numbers and airthmetic operators and pass a lambda function as a command in those buttons .

it is my first experience to making a full projects using oops concepts ,using for loops for buttons and other new things .

Hope you like the project and please comment and share thsi project .

The link for this project is here ::::
https://drive.google.com/open?id=1rzO5Ahsy_iPDGluIjO9zrUl2F3Gd-vHw


you can also follow us on instagram , we daily upload new things on python and GUI projects

instagram link is : https://www.instagram.com/dynamic_codeing/











No comments

Powered by Blogger.