I'm trying to use an Entry
field to get manual input, and then work with that data.
All sources I've found claim I should use the get()
function, but I haven't found a simple working mini example yet, and I can't get it to work.
I hope someone can tel me what I'm doing wrong. Here's a mini file:
from tkinter import *
master = Tk()
Label(master, text="Input: ").grid(row=0, sticky=W)
entry = Entry(master)
entry.grid(row=0, column=1)
content = entry.get()
print(content) # does not work
mainloop()
This gives me an Entry
field I can type in, but I can't do anything with the data once it's typed in.
I suspect my code doesn't work because initially, entry
is empty. But then how do I access input data once it has been typed in?
get
so of course it returns an empty string. – Heisler