How to Create a Software using Python

Let’s make a simple software of our own using Python. We will be making a simple calculator software. Once you get the basics, its no time for to stop. Work on interesting ideas and create a software on your own.
To interact with the users you need an Interface to communicate, i.e. a Graphical User Interface. There are many modules in the python which you can import and code your GUI. Tkinter
is the built-in GUI for the python, so we will be using Tkinter here.
from tkinter import * #refers to class in Tkinter module top = Tk() #Label is the method to print a text in L1 = Label(top, text="HI") L1.pack( side = LEFT) #Entry method to create a blank entry E1 = Entry(top, bd =5) E1.pack(side = RIGHT) #Button method to create a button B=Button(top, text ="Hello",) B.pack() top.mainloop()
When you run the above piece of code, you will get the output as shown below. Upon this code, we will built our software.

After entering 2 numbers and specifying the operation in between them, the answer has to be printed or displayed in the answer entry.
The final code will be:
from tkinter import * def proces(): number1=Entry.get(E1) number2=Entry.get(E2) operator=Entry.get(E3) number1=int(number1) number2=int(number2) if operator =="+": answer=number1+number2 if operator =="-": answer=number1-number2 if operator=="*": answer=number1*number2 if operator=="/": answer=number1/number2 Entry.insert(E4,0,answer) print(answer) #refers to class in Tkinter module top = Tk() L1 = Label(top, text="My calculator",).grid(row=0,column=1) L2 = Label(top, text="Number 1",).grid(row=1,column=0) L3 = Label(top, text="Number 2",).grid(row=2,column=0) L4 = Label(top, text="Operator",).grid(row=3,column=0) L4 = Label(top, text="Answer",).grid(row=4,column=0) E1 = Entry(top, bd =5) E1.grid(row=1,column=1) E2 = Entry(top, bd =5) E2.grid(row=2,column=1) E3 = Entry(top, bd =5) E3.grid(row=3,column=1) E4 = Entry(top, bd =5) E4.grid(row=4,column=1) B=Button(top, text ="Submit", command = proces).grid(row=5,column=1,) top.mainloop()
Outputs:

