the302storm the302storm - 14 days ago 9
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 ()
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)


Thank you

Answer

Use brackets after a.get

print(a.get())