1from Tkinter import *
2
3master = Tk()
4
5e = Entry(master)
6e.pack()
7
8e.focus_set()
9
10def callback():
11 print e.get()
12
13b = Button(master, text="get", width=10, command=callback)
14b.pack()
15
16mainloop()
1v = StringVar()
2e = Entry(master, textvariable=v)
3e.pack()
4
5v.set("a default value")
6s = v.get()