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

Countdown Timer Using Tkinter

Countdown Timer Using Tkinter With the help of tkinter we create a countdown timer project for beginners. Tkinter is the built in python package. Tkinter provides GUI (Graphical User Interface)toolkit. With the help of this developer can create any GUI projects.  Steps of the Project: 1. import tkinter package 2. create a basic gui  3. add entry for Hrs, Mins, & Secs. and start button 4.  Create a function containing logic of timer   Step 1: Importing required packages   Step 2: Create Basic GUI  Step 3: Adding entry for Hrs. Mins. & Secs. and declare variable to store this values. Step 4: Create a function to perform timer. This is how we create countdown timer using python tkinter.  In this project we use divmod() function. This function helps to calculate quotient and remainder both. for example:- 1.print(divmod(25,5)) => (5,0) 2.print(divmod(5,2)) => (2,1) In the first example 25 is divided by 5 so quotient is 5 & remainder i...