I am a beginner in python. Refer the below code.
def FindSqr():
cal = int(ent.get())
ans = str(cal*cal)
lbl2 = Label(root,text=ans).pack()
root = Tk()
lbl1 = Label(root,text="Enter Number Below:").pack()
ent = Entry(root).pack()
btn = Button(root,text="Calculate",command=FindSqr).pack()
root.mainloop()
Error is:
cal = int(ent.get())
AttributeError: 'NoneType' object has no attribute 'get'