You already had your event function. Just correct your code to:

   """Create Submit Button"""
    self.submitButton = Button(master, command=self.buttonClick, text="Submit")
    self.submitButton.grid()

def buttonClick(self):
    """ handle button click event and output text from entry area"""
    print('hello')    # do here whatever you want

This is the same as in @Freak's answer except for the buttonClick() method is now outside the class __init__ method. The advantage is that in this way you can call the action programmatically. This is the conventional way in OOP-coded GUI's.

Answer from joaquin on Stack Overflow
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ tkinter โ€บ python-tkinter-basic-exercise-7.php
Python Tkinter event handling: Button clicks
August 19, 2025 - When the button is clicked, it calls the "on_button_click()" function, which changes the text of the label to "Button Clicked!". ... Previous: Python Tkinter GUI program: Adding labels and buttons.
Discussions

How to handle a click button event in python module tkinter - Stack Overflow
I am trying to make a question game in python using tkinter. I am struggling to define a function that can check the answer that the player clicked on and add to a score that is then printed out be... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Python tkinter button: command calls function without being pressed
You are calling makeGraph() right there, in that line, and passing the value it returns as the command parameter to Button(). If you want the button to call makeGraph(), then you just pass makeGraph. It will be called with no parameters. More on reddit.com
๐ŸŒ r/learnprogramming
2
1
November 8, 2020
calling a python script on button click using python and tkinter
You could take the code of your first script and wrapping it in a function, then you can import the script as a module in the tkinter app and simply call your function like you would with a 3rd party module More on reddit.com
๐ŸŒ r/learnpython
2
3
November 16, 2021
Passing variables into Tkinter button click event
SOLVED: Mutable vs nonmutable data types. Python passes arrays by reference, but array elements only by value. If I were passing in a single variable, this would have worked. command = lambda a = idx: BtnClicked( array[a] , a)) was changed to command = lambda a = idx: BtnClicked( array[a],a , a))d BtnClicked definition was also changed to now take in the index of the array, so now it is working as desired. def BtnClicked(obj,idx, value): obj[idx] = value More on reddit.com
๐ŸŒ r/learnpython
4
1
January 29, 2024
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-handle-a-button-click-event-in-tkinter
How to handle a Button click event in Tkinter?
September 14, 2023 - We can use Button widget to perform a certain task or event by passing the callback in the command.
๐ŸŒ
YouTube
youtube.com โ€บ watch
Tkinter Python GUI Tutorial For Beginners 4 - Handle Button Click Event - YouTube
Welcome to this video on Tkinter Python GUI Tutorial For Beginners. This video shows how to Handle Button Click Event. From this video we will start creating...
Published ย  March 29, 2019
๐ŸŒ
C# Corner
c-sharpcorner.com โ€บ blogs โ€บ using-button-function-in-python-gui-application
Using Button Function In Python GUI Application
March 17, 2020 - When a user clicks that Click Me button the button action will perform to change label text and color in that Python GUI application. ... First, I am Import the tkinter module, Next, assign a class and variables and create application title ...
๐ŸŒ
YouTube
youtube.com โ€บ programming guru
Python button click event - Tkinter button click event - Python Button - YouTube
Python Button click event is a function or code block executed in response to a user clicking a button in a graphical user interface (GUI) built with the Tki...
Published ย  May 17, 2021
Views ย  4K
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ tk_button.htm
Tkinter Button
from tkinter import * from tkinter import messagebox top = Tk() top.geometry("100x100") def helloCallBack(): msg=messagebox.showinfo( "Hello Python", "Hello World") B = Button(top, text ="Hello", command = helloCallBack) B.place(x=50,y=50) top.mainloop()
Find elsewhere
๐ŸŒ
Plus2Net
plus2net.com โ€บ python โ€บ tkinter-button-invoke.php
invoke() to simulate click event of a tkinter button
February 5, 2019 - Tkinter invoke() to simulate click event of a button without actually clicking the same ยท import tkinter as tk # Python 3 my_w = tk.Tk() my_w.geometry("420x200") # width and height of the window b1=tk.Button(my_w,text='One',font=28, command=lambda :l1.config(text='Button One ')) b1.grid(row=0,column=0,padx=30,pady=10) b2=tk.Button(my_w,text='Two',font=28, command=lambda :l1.config(text='Button Two')) b2.grid(row=0,column=1,padx=10,pady=10) #command=lambda :l1.config(text='Button Two') #command=lambda :b1.invoke() l1=tk.Label(my_w,text='No Click ',bg='yellow', width=13,font=('Times',26,'normal')) l1.grid(row=1,column=0,padx=30,pady=10,columnspan=3) #b2.invoke() # Click or Command of button 2 my_w.mainloop() Here the default text on the Label l1 will be displayed and the same will change on click of any button.
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-tkinter-button-click-call-function
Call Function on Tkinter Button Click - Python Examples
You can call function on Tkinter Button click action, by assigning function name to the command option of Button. Just assign the function name without any parenthesis.
๐ŸŒ
Python Course
python-course.eu โ€บ tkinter โ€บ events-and-binds-in-tkinter.php
16. Events and Binds in Tkinter | Tkinter | python-course.eu
#!/usr/bin/python3 # write tkinter as Tkinter to be Python 2.x compatible from tkinter import * def hello(event): print("Single Click, Button-l") def quit(event): print("Double Click, so let's stop") import sys; sys.exit() widget = Button(None, text='Mouse Clicks') widget.pack() widget.bind('<Button-1>', hello) widget.bind('<Double-1>', quit) widget.mainloop() Let's have another simple example, which shows how to use the motion event, i.e.
๐ŸŒ
Instructables
instructables.com โ€บ design โ€บ software
How to Create a Button and Handle Button Click Events in Tkinter (ttkbootstrap) With Python - Instructables
January 23, 2026 - How to Create a Button and Handle Button Click Events in Tkinter (ttkbootstrap) With Python: In this Instructable weโ€™ll guide you through the process of creating a button in a Tkinter window, customizing its appearance using ttkbootstrap, and defining the actions to take when the button is ...
๐ŸŒ
DaniWeb
daniweb.com โ€บ programming โ€บ software-development โ€บ threads โ€บ 66182 โ€บ tk-button-click-response
python - Tk Button Click Response [SOLVED] | DaniWeb
January 2, 2007 - Notes: use add="+" so you do not replace class bindings; if you need to react on release instead of press, bind "<ButtonRelease-1>"; to programmatically trigger the same behavior as a left click, call btn.invoke() or generate "<<Invoke>>". Binding the mouse button to a particular function will do it ... from Tkinter import * def left(event): root.title('clicked left') btn1.config(fg='blue') def right(event): root.title('clicked right') btn1.config(fg='red') root = Tk() root.title('click left or right on button') btn1 = Button(root, text=' Click on me ...
๐ŸŒ
Ufkapano
ufkapano.github.io โ€บ scicomppy โ€บ week15 โ€บ tk_events.html
Python
Whenever the button is pressed, the function is executed. # event2.py import tkinter as tk def increase(): value = int(label["text"]) label["text"] = "{}".format(value + 1) def decrease(): value = int(label["text"]) label["text"] = "{}".format(value - 1) root = tk.Tk() root.rowconfigure(0, ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-creating-a-button-in-tkinter
Python Tkinter - Create Button Widget - GeeksforGeeks
August 22, 2025 - In this example, below code uses the tkinter library to create a graphical user interface. It defines a function, button_clicked(), which prints a message when called.
๐ŸŒ
Qt Wiki
wiki.qt.io โ€บ Qt_for_Python_Tutorial_ClickableButton
Qt for Python Tutorial ClickableButton - Qt Wiki
July 11, 2022 - in the python console each time you click it. Let's starting by importing the necessary PySide2 classes and python sys module: import sys from PySide2.QtWidgets import QApplication, QPushButton ยท Let's also create a python function which writes the message to the console: # Greetings def say_hello(): print("Button clicked, Hello!")
๐ŸŒ
Python Forum
python-forum.io โ€บ thread-30379.html
[Tkinter] Button click problem using OOP
October 18, 2020 - Can anyone help me with a problem illustrated in the code below. I am instantiating three tkinter buttons and saving the objects in a list which is I think a fairly standard way of doing things. The buttons can then be managed, colour change, text et...
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ tkinter tutorial โ€บ tkinter button
Tkinter Button - Python Tutorial
April 3, 2025 - The tkinter button can display: ... Typically, an action is a function you want to execute when users click the button. To execute the function, you assign its name to the command parameter of the Button widget.
๐ŸŒ
Tech with Tim
techwithtim.net โ€บ tutorials โ€บ python-module-walk-throughs โ€บ pyqt5-tutorial โ€บ buttons-and-events
PyQt5 Tutorial - Buttons and Events
For our case we need to handle a press on the button. So, we will start by creating a function that can be called when the event is triggered. def clicked(): print("clicked") # we will just print clicked when the button is pressed
๐ŸŒ
Python Programming
pythonprogramming.net โ€บ pygame-button-function-events
PyGame Buttons, part 5, running functions on a button click
def button(msg,x,y,w,h,ic,ac,action=None): mouse = pygame.mouse.get_pos() click = pygame.mouse.get_pressed() print(click) if x+w > mouse[0] > x and y+h > mouse[1] > y: pygame.draw.rect(gameDisplay, ac,(x,y,w,h)) if click[0] == 1 and action != None: action() else: pygame.draw.rect(gameDisplay, ic,(x,y,w,h)) smallText = pygame.font.SysFont("comicsansms",20) textSurf, textRect = text_objects(msg, smallText) textRect.center = ( (x+(w/2)), (y+(h/2)) ) gameDisplay.blit(textSurf, textRect) and the new game_intro function showing us passing the function: def game_intro(): intro = True while intro: for