Hello I have this code :
import Tkinter as tk
root = tk.Tk()
margin = 0.23
entry = tk.entry(root).grid(row=1,column=1)
def profit_calculator():
profit = margin*int(entry.get())
print(profit)
button_calc = tk.Button(root, text="Calculate", command=profit_calculator).grid(row=2,column=1)
root.mainloop()
I tried to execute this code I put a value in the entry but when I clicked on the button I get this :
AttributeError : 'NoneType' object has no attribute 'get'
I have to use grid absolutely but I don't know why I get this error...
Can you help me ?
Thank you :)