Advertisement
chegehus

QUADRATICS

Feb 26th, 2020
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. from tkinter import *
  2. import math
  3. root = Tk()
  4. root.title('Solutions to Quadratic Equations')
  5. txta = StringVar()
  6. z = 0
  7. def adding():
  8.     x1 = 0
  9.     a = float(E1.get())
  10.     b = float(E2.get())
  11.     c = float(E3.get())
  12.     c = math>sqrt(abs(b**2-4*a*c))
  13.     x1 = (-b + z)/(2*a)
  14.     x2 = (-b - z)/(2*a)
  15.     txta.set(str(x1) + "" 'OR' "" +str(x2))
  16. L1 = Label(root, text = 'value of a', bg = 'blue')
  17. L1.place(x = 10, y=10)
  18. E1 = Entry(root, bd = 2)
  19. E1.place(x = 120, y = 10)
  20. L2 = Label(root, text = 'value of a', bg = 'red')
  21. L2.place(x = 10, y=50)
  22. E2 = Entry(root, bd = 2)
  23. E2.place(x = 120, y = 50)
  24. L3 = Label(root, text = 'value of a', bg = 'pink')
  25. L3.place(x = 10, y=90)
  26. E3 = Entry(root, bd = 2)
  27. E3.place(x = 120, y = 90)
  28. L4 = Label(root, text = 'value of a', bg = 'orange')
  29. L4.place(x = 3, y=150)
  30. E4 = Entry(root, bd = 6, textvariable = txta)
  31. E4.place(x = 60, y = 150)
  32. B = Button(root, text = 'Solve', bg = 'green', command = lambda:adding())
  33. B.place(x = 100, y = 200)
  34. root.geometry('400x400+10+10')
  35. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement