I wrote the code below for a program that calculates the 'delta' that we use for second degree equations. I already wrote a calculator, which gets the numeric value from the entry like this: firstnum=entry.get()
.
However, when I tried to do same on the delta, I get the error:
AttributeError: 'NoneType' object has no attribute 'get'
from tkinter import
from tkinter.font import Font
import sys*
# window interface
r = Tk()
r.geometry("300x500")
r.configure(bg="#414d61")
# commands
def clear():
r.quit()
def delta():
ax = entry_ax.get()
bx = entry_bx.get()
c = entry_c.get()
result = bx * bx - 4 * ax * c
entry_delta.insert(0, result)
# text interface
text = Text(r)
My_font = Font(family="Arial Rounded MT Bold", size=12)
# labels and frames
label_top = Label(r, bg="#414d61", text="x² + (", font=My_font).place(x=80, y=200)
label_top2 = Label(r, bg="#414d61", text=" x) +", font=My_font).place(x=140, y=200)
label_top3 = Label(r, bg="#414d61", text=" =0", font=My_font).place(x=200, y=200)
entry_ax = Entry(r, bg="white", width=2).place(x=60, y=202)
entry_bx = Entry(r, bg="white", width=2).place(x=138, y=202)
entry_c = Entry(r, bg="white", width=2).place(x=198, y=202)
entry_delta = Entry(r, bg="white", width=20).place(x=85, y=350)
# Buttons
b1 = Button(r, bg="#414d61", text="Calculate Delta", font=My_font, command=delta, height=1, width=20)
b1.place(x=40, y=300)
b2 = Button(r, bg="#414d61", text="Exit", font=My_font, command=clear, height=1, width=20)
b2.place(x=40, y=400)
# entries
entry = Label(r, bg="#414d61", text="Delta Calculator (basic gui version)", font=My_font, width=30)
entry.place(x=5, y=100)
r.mainloop()