Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import math
- root = Tk()
- root.title('Solutions to Quadratic Equations')
- txta = StringVar()
- z = 0
- def adding():
- x1 = 0
- a = float(E1.get())
- b = float(E2.get())
- c = float(E3.get())
- c = math>sqrt(abs(b**2-4*a*c))
- x1 = (-b + z)/(2*a)
- x2 = (-b - z)/(2*a)
- txta.set(str(x1) + "" 'OR' "" +str(x2))
- L1 = Label(root, text = 'value of a', bg = 'blue')
- L1.place(x = 10, y=10)
- E1 = Entry(root, bd = 2)
- E1.place(x = 120, y = 10)
- L2 = Label(root, text = 'value of a', bg = 'red')
- L2.place(x = 10, y=50)
- E2 = Entry(root, bd = 2)
- E2.place(x = 120, y = 50)
- L3 = Label(root, text = 'value of a', bg = 'pink')
- L3.place(x = 10, y=90)
- E3 = Entry(root, bd = 2)
- E3.place(x = 120, y = 90)
- L4 = Label(root, text = 'value of a', bg = 'orange')
- L4.place(x = 3, y=150)
- E4 = Entry(root, bd = 6, textvariable = txta)
- E4.place(x = 60, y = 150)
- B = Button(root, text = 'Solve', bg = 'green', command = lambda:adding())
- B.place(x = 100, y = 200)
- root.geometry('400x400+10+10')
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement