Python 3 Tkinter Add Two Numbers GUI Desktop App Full Project For Beginners

You are currently viewing Python 3 Tkinter Add Two Numbers GUI Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be making a add two numbers gui desktop app in tkinter using python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

app.py

 

#add2.py - a label and window program
#andyp 12.11.13

import tkinter

def addNums():
    first=int(firstWin.get())
    second=int(secoWin.get())
    answer=first+second
    txtBx.insert(1.0,str(answer))

#answer=4
bob=tkinter.Tk()
bob.title('adding box')
firstWin= tkinter.Entry (bob)
firstLbl = tkinter.Label (bob, text='Enter first  number')
secoWin= tkinter.Entry (bob)
secoLbl = tkinter.Label (bob, text='Password')
addButton=tkinter.Button(text='add',command=addNums)
txtBx=tkinter.Text(bob,height=1,width=6)
firstLbl.pack()

firstWin.pack()
secoLbl.pack()
secoWin.pack()
addButton.pack()
txtBx.pack()
bob.mainloop()

 

 

Now if you execute the above python script by typing the below command as shown below

 

python app.py

 

Leave a Reply