you can use the sample way with lambda like this:

button = Button(text="press", command=lambda:[function1(), function2()])
Answer from user15068362 on Stack Overflow
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ a single button that fires two commands in tkinter.
r/learnpython on Reddit: A single button that fires two commands in tkinter.
January 28, 2018 -

Hi, i've already made a little program that presses (Ctrl+S) shortcut automatically every x seconds, and i want to add a timer to it, so i need to put two functions in one button, here is a smaller and simpler code just to get the idea:

from tkinter import *

def hello():
    print("HELLO")

def bye():
    print("BYE")

root = Tk()

Button(root, width=7, text='CLICK ME', 
command=hello).pack()

root.mainloop()
Discussions

python - Have multiple commands when button is pressed - Stack Overflow
One button doing two functions on two different clicks. Example START button - after click changes text to STOP and starts function. After second click stop function and changes text to START again. Tried this and it works. I do not know if it is ok or elegant or does not break any python rules (I am a lousy programmer :-) but it works. from tkinter ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How do you have 2+ Function Tkinter Button - Stack Overflow
button=Button(window1,text="Create",command=Store_SQLite) ... I don't think you can put two functions to be triggered in a tkinter button; however, you could use a helper function that executes several other functions: More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - Binding one button to two events with Tkinter - Stack Overflow
I am just getting started with programming and am making a Tic-Tac-Toe program. In my program I have a display function, which changes and makes sure what entered is valid, and a win checker. Is th... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Tkinter - Same event for multiple buttons - Stack Overflow
In that case, you can use the very handy combine_funcs (see: Have multiple commands when button is pressed) to call two functions from one widget. Here is my code. Instead of a list, I simply have a string that is changed and printed with each click. import tkinter as tk root = tk.Tk() ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ python tkinter โ€บ how to bind multiple commands to tkinter button
How to Bind Multiple Commands to Tkinter Button | Delft Stack
February 2, 2024 - This lambda function will execute funcA, funcB, and funcC one by one. try: import Tkinter as tk except: import tkinter as tk class Test: def __init__(self): self.root = tk.Tk() self.root.geometry("200x100") self.button = tk.Button( self.root, text="Click Me", command=lambda: [self.funcA(), self.funcB(), self.funcC()], ) self.button.pack() self.labelA = tk.Label(self.root, text="A") self.labelB = tk.Label(self.root, text="B") self.labelC = tk.Label(self.root, text="C") self.labelA.pack() self.labelB.pack() self.labelC.pack() self.root.mainloop() def funcA(self): self.labelA["text"] = "A responds" def funcB(self): self.labelB["text"] = "B responds" def funcC(self): self.labelC["text"] = "C responds" app = Test()
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ running-multiple-commands-when-a-button-is-pressed-in-tkinter
Running multiple commands when a button is pressed in Tkinter
Sound played") # Wrapper function to execute multiple commands def execute_multiple_commands(): change_color() update_text() play_sound() label = Label(win, text="Click the button below", font=('Arial', 12)) label.pack(pady=20) # Button using wrapper function button = Button(win, text="Multi-Action Button", command=execute_multiple_commands) button.pack(pady=10) win.mainloop()
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-bind-multiple-commands-to-tkinter-button
How to Bind Multiple Commands to Tkinter Button? - GeeksforGeeks
July 23, 2025 - It will immediately call the functions as soon as the application runs, but we want that these functions should be called only when the button is pressed. So the answer is simple if you want to pass arguments to fun1 or fun2 use the below syntax: combine_funcs(lambda: fun1(arguments), lambda: fun2(arguments)) Let see the below example where we actually have parameters to fun1 and fun2. ... # Import tkinter and Button Widget from tkinter import Tk from tkinter.ttk import Button # funcs parameter will have the reference # of all the functions that are # passed as arguments i.e "fun1" and "fun2"
๐ŸŒ
Python Forum
python-forum.io โ€บ thread-15404.html
assigning two function for a single button
How would I be able to assign two function to a single button so they execute one function on the first pressing and execute the second function on second pressing? For example if I made a button (+/-) that should actually display + sign when I click...
Find elsewhere
๐ŸŒ
Medium
bhaveshsingh0124.medium.com โ€บ multi-threading-on-python-tkinter-button-f0d9f759ad3e
Multi-threading in Python Tkinter Button | by Bhavesh Singh Bisht | Medium
August 16, 2020 - The use of lambda provides the functionality to attach many functions to the button but they are executed sequentially. Hence, the progress bar would be completed before the model training has even started or vice-versa.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ create-multiple-buttons-with-different-command-function-in-tkinter
Create multiple buttons with "different" command function in Tkinter
#Import the required Libraries from tkinter import * from tkinter import ttk #Create an instance of Tkinter frame win = Tk() #Set the geometry of the Tkinter frame win.geometry("750x250") #Define a function to update the entry widget def entry_update(text): entry.delete(0,END) entry.insert(0,text) #Create an Entry Widget entry= Entry(win, width= 30, bg= "white") entry.pack(pady=10) #Create Multiple Buttons with different commands button_dict={} option= ["Python", "Java", "Go", "C++"] for i in option: def func(x=i): return entry_update(x) button_dict[i]=ttk.Button(win, text=i, command= func) button_dict[i].pack() win.mainloop()
๐ŸŒ
Quora
quora.com โ€บ How-do-you-run-Tkinter-function-with-both-a-key-bind-and-a-button-command-Python-function-tkinter-development
How to run Tkinter function with both a key bind and a button command (Python, function, tkinter, development) - Quora
Answer: We can use bind() function and use button also at the same time to do this task. Consider the following code (pic) :- Itโ€™s a simple code that show some text(ie. this) and hides it alternately with each button click or pressing x. Output ...
๐ŸŒ
DaniWeb
daniweb.com โ€บ programming โ€บ software-development โ€บ threads โ€บ 70644 โ€บ tkinter-button-command
python - Tkinter Button Command [SOLVED] | DaniWeb
March 20, 2007 - If you want something reusable (especially when different buttons should run different mixes of functions), compose a single callback from multiple callables. This keeps your button code tidy and lets you reuse the same pattern elsewhere. import ...
Top answer
1 of 4
12

Using a list to reference the dynamically created buttons and lambda to store a reference to the index of the button object. You can determine which button was clicked. In the below examples I use .cget("text") on the button object to demonstrate accessing the button widget.

import tkinter as tk

root = tk.Tk()
root.minsize(200, 200)

btn_list = [] # List to hold the button objects

def on_click(idx):
    print(idx) # Print the index value
    print(btn_list[idx].cget("text")) #Print the text for the selected button

for i in range(10):
    # Lambda command to hold reference to the index matched with range value
    b = tk.Button(root, text = f'Button #{i}', command = lambda idx = i: on_click(idx))
    b.grid(row = i, column = 0)

    btn_list.append(b) # Append the button to a list

root.mainloop()

Alternatively you can use bind and then access the widget from the event object generated.

import tkinter as tk
    
root = tk.Tk()
root.minsize(200, 200)

def on_click(event):
    btn = event.widget # event.widget is the widget that called the event
    print(btn.cget("text")) #Print the text for the selected button

for i in range(10):
    b = tk.Button(root, text = f'Button #{i}')
    b.grid(row = i, column = 0)
    # Bind to left click which generates an event object
    b.bind("<Button-1>", on_click)

root.mainloop()
2 of 4
1
  1. @Steven Summers' first example seems most clear to me, but I think doing it without the list is even clearer.
  2. The way I understood the question, you not only want to know which button was clicked but you also want each button to call one other, undescribed function (universal in my example below). In that case, you can use the very handy combine_funcs (see: Have multiple commands when button is pressed) to call two functions from one widget.

Here is my code. Instead of a list, I simply have a string that is changed and printed with each click.

import tkinter as tk

root = tk.Tk()
root.minsize(200, 200)

buttonVal = ''                             

def combine_funcs(*funcs):
    def combined_func(*args, **kwargs):
        for f in funcs:
            f(*args, **kwargs)
    return combined_func

def universal():
    print 'Universal function is called'    

def button_check(buttonName):
    buttonVal = buttonName
    print buttonVal   # Or whatever you want to do with the button info

for i in range(10):
    B1 = tk.Button(root, text = 'Button #%s' % i, command = combine_funcs(universal, lambda buttonName = 'Button #%s' % i:button_check(buttonName)))
    B1.grid(row = i, column = 0)

root.mainloop()
๐ŸŒ
Python Programming
pythonprogramming.net โ€บ passing-functions-parameters-tkinter-using-lambda
Passing functions with Parameters in Tkinter using Lambda
Command is where you can pass functions, but here we're going to pass a lambda function instead, which creates a quick throwaway function, using the parameters we've set. Here's what you should get: If you click the button, you should get a print out to the console with your message. In case you are confused or lost, here's the current code in full up to this point: # The code for changing pages was derived from: http://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter # License: http://creativecommons.org/licenses/by-sa/3.0/ import tkinter as tk LARGE_FONT= ("Verdana",
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ tkinter โ€บ python-tkinter-widgets-exercise-3.php
Python tkinter widgets: Create two buttons exit and hello using tkinter module
August 25, 2025 - import tkinter as tk def write_text(): print("Tkinter is easy to create GUI!") parent = tk.Tk() frame = tk.Frame(parent) frame.pack() text_disp= tk.Button(frame, text="Hello", command=write_text ) text_disp.pack(side=tk.LEFT) exit_button = tk.Button(frame, text="Exit", fg="green", command=quit) exit_button.pack(side=tk.RIGHT) parent.mainloop() ... text_disp= tk.Button(frame, text="Hello", command=write_text) - Create a "Hello" button (text_disp) that calls the write_text function when clicked.