0

i wanna build program to print name of user and i have typed more than way to print the name but in everytime when i test app its show Error File "<pyshell#62>", line 4, in Print AttributeError: 'NoneType' object has no attribute 'get' i need help please


my code

from tkinter import *
def App():

    root = Tk()
    def Print():
        Get_Name = Name.get() # i tried to test this way { str(Name.get()) } and didn't work 
        Label(root,text=f"Hello {Get_Name}").pack()
    label = Label(root,text="Hello World\nType your name : ")
    label.pack()
    Name = Entry(root).pack()
    Button(root,text="Print",command=Print).pack()
    root.mainloop()
Nawaf404
  • 13
  • 1
  • 5
  • In your own words, what are you expecting `Name.get()` to `.get` *from*? I see you have a line `Name = Entry(root).pack()`. Are you expecting `Name` to end up being a name for the `Entry`? – Karl Knechtel Oct 12 '20 at 11:15
  • I have an answer for you: where you have said 'Get_Name = Name.get() you have to actually put 'Name = Entry(root) ' above the variable 'Get_Name' Then where you have said 'Name.get()' it needs to be 'Name.get(0,END)' – some_user_3 Oct 12 '20 at 15:47

0 Answers0