I want to build a data entry application, but the entry boxes do not get the typed value. I know the get() method, but it does not work for some reason.. Here is the relevant code detail:
from tkinter import *
root = Tk()
root.geometry("600x500")
myList = []
class oneClass:
def __init__(self, master):
self.entryName = Entry(master).get()
self.entryName.place(relx=0.5, rely=0.45, anchor=CENTER)
myList.append(self.entryName)
self.buttonPrint = Button(master, text="Click Me!", command=self.print).place(relx=0.5, rely=0.75, anchor=CENTER)
def print(self):
print(myList)
val = oneClass(root)
root.mainloop()
After running I got "AttributeError: 'str' object has no attribute 'place'" message in line 11. So what's the problem?