Skip to main content

Simple Calculator Using Python

    

 Simple Calculator Using Python

    

Hello friends in this blog we will learn how we can create simple calculator using python.

To create calculator we required Tkinter library which is built-in library of python. With the help of this library we can create GUI of the application. 

To create calculator we follow some steps:-

1) Import all required libraries and create the basic window:-


2) Add required widgets to window:- In this step add number and operators buttons to the window.


3) Create function for each button:- In this step create separate functions for 0 to 9 numbers, operator (+,-,*,/), equals, clear buttons.

    i] Function for 0 to 9 numbers:- Here we create one function for 0 to 9 numbers. We pass number as a parameter to function so that one function is enough for 0 to 9 number buttons.

    ii] Function for operators(+,*,-,\):- Here we create separate functions for each operator. 

            



   
    iii] Function for equal button:- In this function actual calculation will perform.


Output:-


To know more about this project please watch this project video.

Comments

Contact Form

Name

Email *

Message *

Popular posts from this blog

Numpy Library

 Hello Guys, In this blog we will learn about the most important library of python which is NUMPY.  What is numpy? Numpy is a python library that provides a multidimensional array object. It provide fast operations on array. With the help of this library we can do mathematical, logical and basic statistical operation on array.  To use numpy library we have to install it in our machine so that we can use this library. To install this library just insert the following command into your command prompt or terminal.  >>> pip install numpy Now you can easily access the numpy library. How to create 1D Array In the above image, first we import the numpy library. Then with the help of array method we can create the numpy array.  On line no. 2 we create the one dimensional array. In this array you can store integers, float etc. In the array  method we must have to pass list to create a array.  How to create 2D Array           ...