Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Calculator.mp4
Binary file not shown.
10 changes: 0 additions & 10 deletions Problem Statement 1/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions Problem Statement 2/README.md

This file was deleted.

23 changes: 23 additions & 0 deletions Problem Statement 3/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from tkinter import *

def btnClick(number):
global operator
operator=operator+str(number)
strrvar.set(operator)

def btnClear():
global operator
operator=''
strvar.set(operator)

def result():
global opearator
res=str(eval(operator))
strvar.set(res)

root=Tk()
root.title("Calculator")
operator=''
strvar=StringVar()

ent=Entry(root,width=50, bd=5, font=
3 changes: 3 additions & 0 deletions Problem Statement 3/p1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import tkinter
wind1=tkinter.Tk()
wind1.title("New title of window")
4 changes: 4 additions & 0 deletions Problem Statement 3/p2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import tkinter
root=tkinter.Tk()
tkinter.Button(root, text='Press Me', command=root.quit).pack()
root.mainloop()
12 changes: 12 additions & 0 deletions Problem Statement 3/p3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tkinter

def wquit():
print('Hello, getting out of here')

root=tkinter.Tk()
widget1=tkinter.Label(root, text='Hello there')
widget1.pack()
widget2=tkinter.Button(root, text='Click to quit', command=wquit)
widget2.pack()

root.mainloop()
81 changes: 81 additions & 0 deletions Problem Statement 3/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from tkinter import *

def btnClick(numbers):
global operator
operator= operator + str(numbers)
text_Input.set(operator)

def btnClear():
global operator
operator=""
text_Input.set("")

def btnEquals():
global operator
sumup= str(eval(operator))
text_Input.set(sumup)
operator=""

cal=Tk()
cal.title("Calculator")
operator=""
text_Input=StringVar()
txtDisplay= Entry(cal, font=('arial', 20, 'bold'), textvariable= text_Input, bd=30, insertwidth= 3, bg= "#FFFFFF", justify="right").grid(columnspan=4)

##################################################################################################################################################
button7= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='7', command= lambda:btnClick(7))
button7.grid(row=1, column=0)

button8= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='8', command= lambda:btnClick(8))
button8.grid(row=1, column=1)

button9= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='9', command= lambda:btnClick(9))
button9.grid(row=1, column=2)

buttonAdd= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20 , 'bold'), text='+', command= lambda:btnClick("+"))
buttonAdd.grid(row=1, column=3)

##################################################################################################################################################
button4= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='4', command= lambda:btnClick(4))
button4.grid(row=2, column=0)

button5= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='5', command= lambda:btnClick(5))
button5.grid(row=2, column=1)

button6= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20 , 'bold'), text='6 ', command= lambda:btnClick(6))
button6.grid(row=2, column=2)

buttonSub= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='-', command= lambda:btnClick("-"))
buttonSub.grid(row=2, column=3)

##################################################################################################################################################
button1= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='1', command= lambda:btnClick(1))
button1.grid(row=3, column=0)

button2= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='2', command= lambda:btnClick(2))
button2.grid(row=3, column=1)

button3= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='3', command= lambda:btnClick(3))
button3.grid(row=3, column=2)

buttonMul= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20 , 'bold'), text='X', command= lambda:btnClick("*"))
buttonMul.grid(row=3, column=3)

##################################################################################################################################################
button0= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='0', command= lambda:btnClick(0))
button0.grid(row=4, column=0)

buttonClr= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20 , 'bold'), text='C', command= lambda:btnClear())
buttonClr.grid(row=4, column=1)

buttonequal= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='=', command= lambda:btnEquals())
buttonequal.grid(row=4, column=2)

buttonDiv= Button(cal, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), text='/', command= lambda:btnClick("/"))
buttonDiv.grid(row=4, column=3)





cal.mainloop()