diff --git a/Problem Statement 1/README.md b/Problem Statement 1/README.md deleted file mode 100644 index 6aaeab6..0000000 --- a/Problem Statement 1/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Problem Statement-1. - - -*** -### Make a desktop assistant using Python as its backend - - - -*** - diff --git a/Problem Statement 2/README.md b/Problem Statement 2/README.md deleted file mode 100644 index baf2489..0000000 --- a/Problem Statement 2/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Problem Statement-2. - - -*** -### Make a Simple Image Editing app - - - -*** - diff --git a/Problem Statement 3/Calci - Demo Video.mp4 b/Problem Statement 3/Calci - Demo Video.mp4 new file mode 100644 index 0000000..9dfcd7e Binary files /dev/null and b/Problem Statement 3/Calci - Demo Video.mp4 differ diff --git a/Problem Statement 3/Calculator/calculator.py b/Problem Statement 3/Calculator/calculator.py new file mode 100644 index 0000000..d4e48be --- /dev/null +++ b/Problem Statement 3/Calculator/calculator.py @@ -0,0 +1,144 @@ +from tkinter import* +import math +import parser +import speech_recognition as sr + +def btnClick(numbers): + global operator + operator=operator+str(numbers) + text_Input.set(operator) + +def btnClear(): + global operator + operator="" + text_Input.set("") + +def btnequal(): + global operator + if(operator=='🔊'): + r = sr.Recognizer() + with sr.Microphone() as source: + audio = r.listen(source) + try: + text = r.recognize_google(audio) + except: + text = "0" + sumup=str(eval(text)) + elif(operator[0]=='s'): + val = operator[3:] + sumup = str(math.sin(eval(val))) + elif(operator[0]=='c'): + val = operator[3:] + sumup = str(math.cos(eval(val))) + elif(operator[0]=='l'): + val = operator[3:] + sumup = str(math.log(eval(val))) + elif(operator[0]=='e'): + val = operator[1:] + sumup = str(pow(2.718281828459045,eval(val))) + else: + sumup=str(eval(operator)) + text_Input.set(sumup) + operator="" +class Calc(): + def _init_(self): + self.total=0 + self.current="" + self.input_value=True + self.check_sum=False + self.op="" + self.result=False + +def numberEnter(self,num): + self.result=False + firstnum=txtDisplay.get() + secondnum=str(num) + if self.input_value: + self.current=secondnum + self.input_value=False + else: + if secondnum =='.': + if secondnum in firstnum: + return + self.current=firstnum+secondnum + self.display(self.current) + +def e(self): + self.result=False + self.current=math.e + self.disolay(self.current) + +added_value=Calc() + + + + +cal=Tk() +cal.title("Calculator") +operator="" +text_Input=StringVar() + + + +txtDisplay=Entry(cal,font=('comic sans',20,'bold'),textvariable=text_Input, bd=30, insertwidth=4,bg="grey",justify='right').grid(columnspan=4) + +#******************************************************************************************************************************************************************** + +btn7=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="(",bg="light blue",command=lambda:btnClick('(')).grid(row=1,column=0) +btn8=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=")",bg="light blue",command=lambda:btnClick(')')).grid(row=1,column=1) +btn9=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=".",bg="light blue",command=lambda:btnClick('.')).grid(row=1,column=2) +Addition=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="🔊",bg="light grey",command=lambda:btnClick('🔊')).grid(row=1,column=3) + +#******************************************************************************************************************************************************************** + + +btn7=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="7",bg="light blue",command=lambda:btnClick(7)).grid(row=2,column=0) +btn8=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="8",bg="light blue",command=lambda:btnClick(8)).grid(row=2,column=1) +btn9=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="9",bg="light blue",command=lambda:btnClick(9)).grid(row=2,column=2) +Addition=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=" + ",bg="light grey",command=lambda:btnClick('+')).grid(row=2,column=3) + + +#******************************************************************************************************************************************************************** + + +btn4=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="4",bg="light blue",command=lambda:btnClick(4)).grid(row=3,column=0) +btn5=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="5",bg="light blue",command=lambda:btnClick(5)).grid(row=3,column=1) +btn6=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="6",bg="light blue",command=lambda:btnClick(6)).grid(row=3,column=2) +Substraction=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=" - ",bg="light grey",command=lambda:btnClick('-')).grid(row=3,column=3) + + +#******************************************************************************************************************************************************************** + + +btn1=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="1",bg="light blue",command=lambda:btnClick(1)).grid(row=4,column=0) +btn2=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="2",bg="light blue",command=lambda:btnClick(2)).grid(row=4,column=1) +btn3=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="3",bg="light blue",command=lambda:btnClick(3)).grid(row=4,column=2) +Multiply=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=" x ",bg="light grey",command=lambda:btnClick('*')).grid(row=4,column=3) + + +#******************************************************************************************************************************************************************** + + +btn0=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="0",bg="light blue",command=lambda:btnClick(0)).grid(row=5,column=0) +btnclear=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="C",bg="light blue",command=btnClear).grid(row=5,column=1) +btnequal=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text="=",bg="light blue",command=btnequal).grid(row=5,column=2) +division=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=" / ",bg="light grey",command=lambda:btnClick('/')).grid(row=5,column=3) + + +#******************************************************************************************************************************************************************** + + +btns=Button(cal,padx=16,bd=8,fg="red",font=('comic sans',20,'bold'),text="sin",bg="light grey",command=lambda:btnClick('sin')).grid(row=6,column=0) +btnc=Button(cal,padx=16,bd=8,fg="red",font=('comic sans',20,'bold'),text="cos",bg="light grey",command=lambda:btnClick('cos')).grid(row=6,column=1) +btnl=Button(cal,padx=16,bd=8,fg="red",font=('comic sans',20,'bold'),text="log",bg="light grey",command=lambda:btnClick('log')).grid(row=6,column=2) +exp=Button(cal,padx=30,bd=8,fg="red",font=('comic sans',20,'bold'),text=" e ",bg="light grey",command=lambda:btnClick('e')).grid(row=6,column=3) + + + + + + + + + +cal.mainloop() diff --git a/Problem Statement 3/README.md b/Problem Statement 3/README.md index b4683b3..2d790cd 100644 --- a/Problem Statement 3/README.md +++ b/Problem Statement 3/README.md @@ -8,3 +8,10 @@ *** +# Solution + +## Calci + +

Calci is a calculator that is built using Tkinter that is the de facto way in Python to create Graphical User interfaces. Calci can perform basic mathematical operations such as - Addition, Substraction, Multiplication and Division, in addition to this it is also capable of performing sine, cosine and logarithmic operations. The feature that makes Calci differnt from others is that it can perform calculations by taking input through user's voices.

+

Demo - Calci

+