Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

import tkinter as tk

from functools import partial

def findsum(sum, num1, num2,num3):


n1 = int(num1.get())
n2 = int(num2.get())
n3 = int(num3.get())
n4 = n1 + n2+n3
sum.config(text="Result = %d" % n4)
return

root = tk.Tk()
root.title("Xiith.com")
root.geometry("700x500")

number1 = tk.StringVar()
number2 = tk.StringVar()
number3 = tk.StringVar()

l1 = tk.Label(root, text="Enter 1st number").place(x=20, y=60)


l2 = tk.Label(root, text="Enter 2nd number").place(x=20, y=120)
l3 = tk.Label(root, text="Enter 3nd number").place(x=20, y=160)

t1 = tk.Entry(root, textvariable=number1).place(x=200, y=60)


t2 = tk.Entry(root, textvariable=number2).place(x=200, y=120)
t3 = tk.Entry(root, textvariable=number3).place(x=200, y=160)

labelResult = tk.Label(root)
labelResult.place(x=250, y=200)

findsum = partial(findsum, labelResult, number1, number2,number3)

b1 = tk.Button(root, text="ADD", command=findsum).place(x=200, y=300)


b2 = tk.Button(root, text="Cancel", command=root.destroy).place(x=250, y=300)

root.mainloop()

************************

import tkinter as tk
from functools import partial

def findsum(sum, num2,num3):

n2 = int(num2.get())
n3 = int(num3.get())
n4 = n2*n3
sum.config(text="Result = %d" % n4)
return

root = tk.Tk()
root.title("Xiith.com")
root.geometry("700x500")

number1 = tk.StringVar()
number2 = tk.StringVar()
number3 = tk.StringVar()

l1 = tk.Label(root, text="Enter Name of item").place(x=20, y=60)


l2 = tk.Label(root, text="Enter Qty").place(x=20, y=120)
l3 = tk.Label(root, text="Enter Rate ").place(x=20, y=160)

t1 = tk.Entry(root, textvariable=number1).place(x=200, y=60)


t2 = tk.Entry(root, textvariable=number2).place(x=200, y=120)
t3 = tk.Entry(root, textvariable=number3).place(x=200, y=160)

labelResult = tk.Label(root)
labelResult.place(x=250, y=200)

findsum = partial(findsum, labelResult, number2,number3)

b1 = tk.Button(root, text="ADD", command=findsum).place(x=200, y=300)


b2 = tk.Button(root, text="Cancel", command=root.destroy).place(x=250, y=300)

root.mainloop()

You might also like