This can be done using a lambda, like so:

button = Tk.Button(master=frame, text='press', command= lambda: action(someNumber))

This is a simple way to bind the argument without an explicit wrapper method or modifying the original action.

Answer from Voo on Stack Overflow
🌐
Tutorialspoint
tutorialspoint.com › python › tk_button.htm
Tkinter Button
options − Here is the list of most commonly used options for this widget. These options can be used as key-value pairs separated by commas. Following are commonly used methods for this widget − · Try the following example yourself − · 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() When the above code is executed, it produces the following result − ·
🌐
Python Tutorial
pythontutorial.net › home › tkinter tutorial › tkinter button
Tkinter Button - Python Tutorial
April 3, 2025 - The button’s command is assigned to a lambda expression that closes the main window. The following program shows how to display an image button. To practice this example, you need to download the following image first: Just right-click and save it into a folder that is accessible from the following program, e.g., assets folder: import tkinter as tk from tkinter import ttk from tkinter.messagebox import showinfo # main window root = tk.Tk() root.geometry('300x200') root.resizable(False, False) root.title('Image Button Demo') def handle_click(): showinfo( title='Information', message='Download button clicked!'
🌐
Python Course
python-course.eu › tkinter › buttons-in-tkinter.php
3. Buttons in Tkinter | Tkinter | python-course.eu
import tkinter as tk def write_slogan(): print("Tkinter is easy to use!") root = tk.Tk() frame = tk.Frame(root) frame.pack() button = tk.Button(frame, text="QUIT", fg="red", command=quit) button.pack(side=tk.LEFT) slogan = tk.Button(frame, text="Hello", command=write_slogan) slogan.pack(side=tk.LEFT) root.mainloop()
🌐
Stack Overflow
stackoverflow.com › questions › 75542846 › python-tkinter-button-commands
python tkinter button commands - Stack Overflow
import tkinter from play_function import * window = tkinter.Tk() screen_width = window.winfo_screenwidth() screen_height = window.winfo_screenheight() window.config ( width = screen_width ) window.config ( height = screen_height ) window.config ( background = "black" ) title = tkinter.Label ( window , text = "Scrabble" , background = "black" , foreground = "green" , font = ( "Comic Sans MS" , 200 ) ) title.pack() play_button = tkinter.Button ( window , text = "PLAY" , background = "blue" , foreground = "black" , font = ( "Comic Sans MS" , 80 ) ) exit_button = tkinter.Button ( window , text = "
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-creating-a-button-in-tkinter
Python Tkinter - Create Button Widget - GeeksforGeeks
August 22, 2025 - invoke(): Calls the button's command callback, and returns what that function returns. Has no effect if the button is disabled or there is no callback. 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.
🌐
Python GUIs
pythonguis.com › tutorials › getting started with tkinter › create buttons in tkinter
Button Widgets in Tkinter
July 13, 2022 - In this tutorial, we will learn how to make use of buttons in our Tkinter applications using the Button widget.
🌐
TutorialKart
tutorialkart.com › python › tkinter › button › command
Tkinter Button command - Call Function on Button Click
November 30, 2020 - import tkinter window_main = ... submitFunction() : print('Submit button is clicked.') button_submit = tkinter.Button(window_main, text ="Submit", command=submitFunction) button_submit.config(width=20, height=2) button_submit.pack() ...
Find elsewhere
🌐
15. The Menu widget
anzeljg.github.io › rin2 › book2 › 2405 › docs › tkinter › button.html
7. The Button widget
Calls the button's command callback, and returns what that function returns. Has no effect if the button is disabled or there is no callback. Next: 8. The Canvas widget · Contents: Tkinter 8.5 reference: a GUI for Python · Previous: 6. Exception handling ·
🌐
Python Tutorial
pythontutorial.net › home › tkinter tutorial › tkinter command binding
Tkinter Command Binding - Python Tutorial
April 3, 2025 - Note that you pass the callback without parentheses () within the command option. Otherwise, the callback would be called as soon as the program runs. The following program illustrates how to associate the button_clicked callback function with the Button widget: import tkinter as tk from tkinter import ttk root = tk.Tk() def button_clicked(): print('Button clicked') button = ttk.Button(root, text='Click Me', command=button_clicked) button.pack() root.mainloop()Code language: Python (python)
🌐
Delft Stack
delftstack.com › home › howto › python tkinter › how to pass arguments to tkinter button command
How to Pass Arguments to Tkinter Button Command | Delft Stack
February 2, 2024 - from sys import version_info if version_info.major == 2: import Tkinter as tk elif version_info.major == 3: import tkinter as tk app = tk.Tk() labelExample = tk.Button(app, text="0") def change_label_number(num): counter = int(str(labelExample["text"])) counter += num labelExample.config(text=str(counter)) buttonExample = tk.Button( app, text="Increase", width=30, command=lambda: change_label_number(2) ) buttonExample.pack() labelExample.pack() app.mainloop() ... You don’t need any arguments in this example, therefore, you could leave the argument list empty and only give the expression.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-pass-arguments-to-tkinter-button-command
How to Pass Arguments to Tkinter Button Command? - GeeksforGeeks
October 3, 2022 - Prerequisites: Tkinter Python's Tkinter module offers the Button function to create a button in a Tkinter Window to execute any task once the button is clicked. The task can be assigned in the command parameter of Button() function. Given below are various methods by which this can be achieved.
🌐
Python Forum
python-forum.io › thread-28552.html
button command tkinter
May 17, 2021 - Hello Python Users: The following is a simple Python program. If you press the button with label red it prints 'red'. If you press the button with label blue it prints 'blue'. One thing that frustrates me is that I have to write a function for ev...
🌐
GitHub
github.com › Akuli › tkinter-tutorial › blob › master › buttons.md
tkinter-tutorial/buttons.md at master · Akuli/tkinter-tutorial
As usual, all possible options are listed in the ttk_button(3tk) manual page. One of these options is command, and if we set it to a function it will be ran when the button is clicked. This program prints hello every time we click its button: import tkinter from tkinter import ttk def print_hello(): print("hello") root = tkinter.Tk() big_frame = ttk.Frame(root) big_frame.pack(fill='both', expand=True) button = ttk.Button(big_frame, text="Print hello", command=print_hello) button.pack() root.mainloop()
Author   Akuli
🌐
Tk Tutorial
tk-tutorial.readthedocs.io › en › latest › button › button.html
Button — Tk tutorial 2020 documentation
import tkinter as tk root = tk.Tk() root.title("Feet to meters") Two of the widgets, the entry widget and the label widget, have special StringVar variables: ... tk.Entry(root, width=10, textvariable=feet).pack() tk.Button(root, text='Convert feet to meters', command=calculate).pack() tk.Label(root, textvariable=meters).pack()
🌐
Tcl Wiki
wiki.tcl-lang.org › page › tkinter.Button
tkinter.Button
If "option" is specified, then ... (this list will be identical to the corresponding sublist of the value returned if no option is specified). If **options are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the method returns an empty string. Option may have any of the values accepted by the Button ...
🌐
CustomTkinter
customtkinter.tomschimansky.com
Official Documentation And Tutorial | CustomTkinter
CustomTkinter is a python desktop UI-library based on Tkinter, which provides modern looking and fully customizable widgets. With CustomTkinter you'll get a consistent look across all desktop platforms (Windows, macOS, Linux). Simple · Object Oriented · import customtkinter def button_callback(): print("button clicked") app = customtkinter.CTk() app.geometry("400x150") button = customtkinter.CTkButton(app, text="my button", command=button_callback) button.pack(padx=20, pady=20) app.mainloop() import customtkinter class App(customtkinter.CTk): def __init__(self): super().__init__() self.geometry("400x150") self.button = customtkinter.CTkButton(self, text="my button", command=self.button_callbck) self.button.pack(padx=20, pady=20) def button_callbck(self): print("button clicked") app = App() app.mainloop() With just a few lines of code, you already get a fully working program:
🌐
Python Basics
pythonbasics.org › home › tkinter › tkinter buttons (gui programming)
Tkinter buttons (GUI Programming) - pythonbasics.org
from tkinter import * class Window(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master # widget can take all window self.pack(fill=BOTH, expand=1) # create button, link it to clickExitButton() exitButton = Button(self, text="Exit", command=self.clickExitButton) # place button at (0,0) exitButton.place(x=0, y=0) def clickExitButton(self): exit() root = Tk() app = Window(root) root.wm_title("Tkinter button") root.geometry("320x200") root.mainloop()
🌐
Python Programming
pythonprogramming.net › passing-functions-parameters-tkinter-using-lambda
Passing functions with Parameters in Tkinter using Lambda
class StartPage(tk.Frame): def __init__(self, parent, controller): tk.Frame.__init__(self,parent) label = tk.Label(self, text="Start Page", font=LARGE_FONT) label.pack(pady=10,padx=10) button = tk.Button(self, text="Visit Page 1", command=lambda: qf("Check me out, I'm passing vars!")) button.pack()
🌐
Stack Overflow
stackoverflow.com › questions › 50787864 › how-do-i-make-a-tkinter-button-in-an-list-of-buttons-return-its-index
python - How do I make a tkinter button in an list of buttons return its index? - Stack Overflow
from tkinter import * root = Tk() files = [] #creates list to replace your actual inputs for troubleshooting purposes btn = [] #creates list to store the buttons ins for i in range(50): #this just popultes a list as a replacement for your actual ...