Python Forum
[Tkinter] How make a button perform a function after the user inputs numbers - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] How make a button perform a function after the user inputs numbers (/thread-18566.html)



How make a button perform a function after the user inputs numbers - Zephyrforce - May-22-2019

I'm dabbling in GUI to implement the program I made for an assignment into a GUI, but I have no idea how to solve this.
My plan was for the user to enter numbers into a grid before pressing a button to use those numbers in calculation. I wanted to try printing the number that the user entered to understand how to implement it but he problem is that the program prints the name of the tkinter.Entry instead of printing the number that the user entered.

import tkinter
def skin():
    print(entry_1)
core = tkinter.Tk()
core.title("GUI")
core.geometry("500x500")
label_1 = tkinter.Label(core, text="Year")
label_2 = tkinter.Label(core, text="Day")
entry_1 = tkinter.Entry(core)
entry_2 = tkinter.Entry(core)
label_1.grid(row=0, sticky="E")
label_2.grid(row=1, sticky="E")
entry_1.grid(row=0,column=1)
entry_2.grid(row=1,column=1)
check= tkinter.Button(core, text="Calculate", command=lambda:skin())
check.grid(row=2)
core.mainloop()



RE: How make a button perform a function after the user inputs numbers - woooee - May-22-2019

That's in every tutorial. Please study a tutorial first so we aren't asked to answer the same beginner questions over and over http://effbot.org/tkinterbook/entry.htm