the302storm the302storm - 1 year ago 85
Python Question

tkinter entry widget .get fails to get data

I have a problem to get this code work. I want it to print the input of the entry widget, but it doesn't work.

The shell gives me this message:

<bound method Entry.get of <tkinter.Entry object .55491440>>

The code is the following:

from tkinter import *

root = Tk ()

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 )

Thank you

Answer Source

Use brackets after a.get