I am experimenting with Tkinter for the first time, and am trying to call a function when a button is clicked. This is part of my code. mt is referring to a label that I have made dynamic by attaching it to a label so that I can change what the label says. I want the user to be able to type in something into an entry box, hit the button, and the it will change the label to what was typed.
def new(self):
mt.set("New")
e1 = Entry(master)
e1.pack()
def new_ok(self):
mt.set("OK")
#the next part is what I need help with
if (checks if button has been clicked) button has been clicked:
mt.set("#what it says in the entry box#")
How should I do this? I have looked on tutorials and read them but none of them have clearly acknowledged how to check if a button has been pressed and to respond.