我有一个问题是让这段代码工作。我希望它打印输入小部件的输入,但它不起作用。
shell给了我这条消息:
<bound method Entry.get of <tkinter.Entry object .55491440>>
代码如下:
from tkinter import *
root = Tk ()
root.title("tab")
root.geometry("300x300")
def printer():
print (a.get)
num = IntVar()
a = Entry(root, textvariable = num)
b = Label(root, text = "day")
a.grid(row=0, column=1, sticky = W)
b.grid(row=0, column=0, sticky = W)
buttonGDO = Button (root, text="Enter", command = printer )
buttonGDO.grid(row=4)
谢谢
答案 0 :(得分:3)
在a.get
之后使用括号print(a.get())