Python Forum
[Tkinter] How make a button perform a function after the user inputs numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How make a button perform a function after the user inputs numbers
#1
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()
Reply
#2
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] how to make label or button not visible with the place method? nowayj63 2 2,790 Jan-03-2023, 06:29 PM
Last Post: Yoriz
Question [Tkinter] How to make split button? teknixstuff 2 1,059 Jan-03-2023, 06:21 PM
Last Post: Yoriz
  button enabled only when all the inputs are filled cybertooth 5 5,526 Oct-22-2021, 10:10 PM
Last Post: deanhystad
  Creating a function interrupt button tkinter AnotherSam 2 5,522 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Have tkinter button toggle on and off a continuously running function AnotherSam 5 5,006 Oct-01-2021, 05:00 PM
Last Post: Yoriz
  [Tkinter] Make my button text update? Skata100 1 2,034 Aug-07-2021, 05:37 AM
Last Post: deanhystad
Star [Tkinter] How to perform math function in different page of Tkinter GUI ravaru 2 4,570 Oct-23-2020, 05:46 PM
Last Post: deanhystad
  Class function does not create command button Heyjoe 2 2,273 Aug-22-2020, 08:06 PM
Last Post: Heyjoe
  How to make button text bold in Tkinter? scratchmyhead 2 12,038 May-16-2020, 02:53 AM
Last Post: scratchmyhead
  [Tkinter] how to celect com port from spinbox and make connect button 00alkskodi00 0 2,442 Apr-20-2020, 02:26 PM
Last Post: 00alkskodi00

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020