Widżet 'Entry' jest używany do pobrania jednego wiersza tekstu od użytkownika, np. nazwiska czy adresu email.
# entry1.py
import tkinter as tk   # Py3
root = tk.Tk()
label = tk.Label(root, text="Name", bg="red")
entry = tk.Entry(root, width=40)
button1 = tk.Button(root, text="Print", command=lambda: print(entry.get()))
button2 = tk.Button(root, text="Clear", command=lambda: entry.delete(0, tk.END))
label.grid()
entry.grid()
button1.grid()
button2.grid()
entry.focus()   # save a click
entry.bind('<Return>', (lambda event: print(entry.get())))
# lambda is used to ignore the 'event' argument
#root.bind('<Return>', (lambda event: print("message from root")))
root.mainloop()   # run the tkinter event loop
Wybrane 'keyword arguments' dla Entry()
master=root     # pierwszy argument
fg="white"   # set the text color to white ('fg' or 'foreground')
bg="black"   # set the background color to black ('bg' or 'background')
width=50   # in text units (no height argument)
show='*'   # for passwords
state='disabled'   # set the widget readonly
textvariable=strvar   # a variable linked to the entry
Operacje name = entry.get() # pobranie stringu z widżetu entry.delete(pos) # usunięcie znaku na danej pozycji entry.delete(first, last) # usunięcie zakresu znaków [first:last] entry.delete(first, tk.END) # usunięcie do końca napisu entry.insert(pos, "text") # wstawienie tekstu od danej pozycji entry.insert(0, "What is your name?") # tekst z informacją dla użytkownika