(disclaimer: I'm not good at English, so nvm)
I recently started to learn a python GUI called tkinter. I'm not sure why but the get() function of Entry is not working.
My Code:
from tkinter import *
root = Tk()
root.geometry("500x300")
var = Entry(root, width = 50).pack()
text = var.get()
root.mainloop()
And here is the output:
Traceback (most recent call last):
File "D:\Python\Tkinter\Tkinter tutorial.py", line 8, in <module>
text = var.get()
AttributeError: 'NoneType' object has no attribute 'get' <---- This this the problem
[Finished in 2.4s with exit code 1]
[cmd: ['py', '-u', 'D:\\Python\\Tkinter\\Tkinter tutorial.py']]
[dir: D:\Python\Tkinter]
[path: C:\Program Files\Python37;C:\Program Files\Python37\Scripts]