A simple example without classes:
from tkinter import *
master = Tk()
# Create this method before you create the entry
def return_entry(en):
"""Gets and prints the content of the entry"""
content = entry.get()
print(content)
Label(master, text="Input: ").grid(row=0, sticky=W)
entry = Entry(master)
entry.grid(row=0, column=1)
# Connect the entry with the return button
entry.bind('<Return>', return_entry)
mainloop()
Above was the answer to this question: Why is Tkinter Entry's get function returning nothing?
So I checked the code and it worked. However- I don't understand why there is an 'en' in the 'return_entry' brackets. It isn't mentioned in any other parts of the code so I think it is syntax- but for what?
I would have left a comment on said answer if I hadn't seen that OP's account has been inactive for 2 years