Using the calculator program that you designed previously, add the functionality for the following buttons: C will clear the label. will add sqrt( to the label. x^y will add ^ to the label. % will add % to the label. LOG will add log( to the label. Will add value 3.14159... to the label. = will evaluate the expression. User will be notified of any syntax or division by 0 error. Note: For square root symbol, copy √ and paste it in the text of the button. For Π symbol, use text=u"\u220f" in the definition of the button.   The code I want to add the functions in: from tkinter import * window=Tk() window.title("Calculator") lbl1=Label(text="",width=15,bg="#40E0D0") lbl1.place(x=0,y=10) window.resizable(False,False) btn1=Button(text=" C ") btn1.place(x=0,y=40) btn2=Button(text=" √ ") btn2.place(x=35,y=40) btn3=Button(text="x^y") btn3.place(x=72,y=40) btn4=Button(text=" % ") btn4.place(x=115,y=40) btn5=Button(text=" 1 ") btn5.place(x=0,y=85) btn6=Button(text=" 2 ") btn6.place(x=35,y=85) btn7=Button(text=" 3 ") btn7.place(x=72,y=85) btn8=Button(text=" + ") btn8.place(x=115,y=85) btn9=Button(text=" 4 ") btn9.place(x=0,y=130) btn10=Button(text=" 5 ") btn10.place(x=35,y=130) btn11=Button(text=" 6 ") btn11.place(x=72,y=130) btn12=Button(text=" - ") btn12.place(x=115,y=130) btn13=Button(text=" 7 ") btn13.place(x=0,y=175) btn14=Button(text=" 8 ") btn14.place(x=35,y=175) btn15=Button(text=" 9 ") btn15.place(x=72,y=175) btn16=Button(text=" * ") btn16.place(x=115,y=175) btn17=Button(text=" 0 ") btn17.place(x=0,y=220) btn18=Button(text=" . ") btn18.place(x=35,y=220) btn19=Button(text="LOG") btn19.place(x=72,y=220) btn20=Button(text=" / ") btn20.place(x=121,y=220) btn21=Button(text=" ( ") btn21.place(x=0,y=265) btn22=Button(text=" ) ") btn22.place(x=35,y=265) btn23=Button(text=u" \u220f ") btn23.place(x=72,y=265) btn24=Button(text=" = ") btn24.place(x=117,y=265) window.geometry("155x310") window.mainloop()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using the calculator program that you designed previously, add the functionality for the following buttons:
C will clear the label.
will add sqrt( to the label.
x^y will add ^ to the label.
% will add % to the label.
LOG will add log( to the label.
Will add value 3.14159... to the label.
= will evaluate the expression. User will be notified of any syntax or division by 0 error.

Note: For square root symbol, copy √ and paste it in the text of the button.
For Π symbol, use text=u"\u220f" in the definition of the button.

 

The code I want to add the functions in:

from tkinter import *

window=Tk()
window.title("Calculator")
lbl1=Label(text="",width=15,bg="#40E0D0")
lbl1.place(x=0,y=10)
window.resizable(False,False)

btn1=Button(text=" C ")
btn1.place(x=0,y=40)

btn2=Button(text=" √ ")
btn2.place(x=35,y=40)

btn3=Button(text="x^y")
btn3.place(x=72,y=40)

btn4=Button(text=" % ")
btn4.place(x=115,y=40)

btn5=Button(text=" 1 ")
btn5.place(x=0,y=85)

btn6=Button(text=" 2 ")
btn6.place(x=35,y=85)

btn7=Button(text=" 3 ")
btn7.place(x=72,y=85)

btn8=Button(text=" + ")
btn8.place(x=115,y=85)

btn9=Button(text=" 4 ")
btn9.place(x=0,y=130)

btn10=Button(text=" 5 ")
btn10.place(x=35,y=130)

btn11=Button(text=" 6 ")
btn11.place(x=72,y=130)

btn12=Button(text=" - ")
btn12.place(x=115,y=130)

btn13=Button(text=" 7 ")
btn13.place(x=0,y=175)

btn14=Button(text=" 8 ")
btn14.place(x=35,y=175)

btn15=Button(text=" 9 ")
btn15.place(x=72,y=175)

btn16=Button(text=" * ")
btn16.place(x=115,y=175)

btn17=Button(text=" 0 ")
btn17.place(x=0,y=220)

btn18=Button(text=" . ")
btn18.place(x=35,y=220)

btn19=Button(text="LOG")
btn19.place(x=72,y=220)

btn20=Button(text=" / ")
btn20.place(x=121,y=220)

btn21=Button(text=" ( ")
btn21.place(x=0,y=265)

btn22=Button(text=" ) ")
btn22.place(x=35,y=265)

btn23=Button(text=u" \u220f ")
btn23.place(x=72,y=265)

btn24=Button(text=" = ")
btn24.place(x=117,y=265)

window.geometry("155x310")
window.mainloop()

7"log(5)
v x^y %
1
2
4 5
6
7 8
9
LOG /
(
=
II
3.
Transcribed Image Text:7"log(5) v x^y % 1 2 4 5 6 7 8 9 LOG / ( = II 3.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ListBox
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education