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
🌐
Python Tutorial
pythontutorial.net › home › tkinter tutorial › tkinter button
Tkinter Button - Python Tutorial
April 3, 2025 - The **kw is one or more keyword arguments you use to change the appearance and behaviors of the button. Here are the common configurations of the button widget: button = ttk.Button( master, text=label, command=fn )Code language: Python (python)
Discussions

[Tkinter] Button command is executed as soon as the program is run without pressing the button
When you do command= onclick(), this calls onclick and passes its return value to Button. You need to pass the function itself without calling it, so no parentheses: btn1 = Button(main, text = 'Press to Begin', command= onclick) More on reddit.com
🌐 r/learnpython
5
19
December 30, 2021
user interface - Change command Method for Tkinter Button in Python - Stack Overflow
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created? 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
Tkinter button command using lambda to call a class method - how???
command=self.open_notebook will work, and is a better than using lambda in my opinion. You also need to move most of the code under def __init__ rather than where it is. class MainWidget: def __init__(self): root = Tk() root.geometry("400x400") search_frame = Frame(root) search_frame.pack() self.search_function = SearchFunction(search_frame) open_notebook_button = Button(root, text="Open", command=self.open_notebook) open_notebook_button.pack() root.mainloop() def open_notebook(self): self.search_function.get_emp_id() # and more stuff to add later More on reddit.com
🌐 r/Tkinter
4
4
September 11, 2022
🌐
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) ...
🌐
Python Tutorial
pythontutorial.net › home › tkinter tutorial › tkinter command binding
Tkinter Command Binding - Python Tutorial
April 3, 2025 - ttk.Button(root, text='Click Me',command=button_clicked)Code language: Python (python) 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)
🌐
TutorialKart
tutorialkart.com › python › tkinter › button › command
Tkinter Button command - Call Function on Button Click
November 30, 2020 - import tkinter window_main = tkinter.Tk(className='Tkinter - TutorialKart', ) window_main.geometry("400x200") def 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() window_main.mainloop() ... When user clicks the Submit button, submitFunction() is called. In this example, we are just printing a string to standard console. Submit button is clicked. In this Python Tutorial, we learned about Tkinter Button bg option, to change background color, with the help of example Python programs.
🌐
Python GUIs
pythonguis.com › tutorials › getting started with tkinter › create buttons in tkinter
Button Widgets in Tkinter
July 13, 2022 - We create the turn_off, vol_up, and vol_down buttons in a similar fashion and pack them with pack(). Only one of these buttons, turn_off, does something because we used the keyword command argument to make the button call root.destroy(), which closes the root window immediately: ... The complete guide to packaging Python GUI applications with PyInstaller.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-pass-arguments-to-tkinter-button-command
How to Pass Arguments to Tkinter Button Command? - GeeksforGeeks
July 23, 2025 - Python3 · # importing tkinter ... root.title("Welcome to GeekForGeeks") root.geometry("380x400") # creating button btn = tk.Button(root, text="Press", command=lambda: func("See this worked!")) btn.pack() # running the ...
Find elsewhere
🌐
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.
🌐
Python Course
python-course.eu › tkinter › buttons-in-tkinter.php
3. Buttons in Tkinter | Tkinter | python-course.eu
import tkinter as tk counter = 0 def counter_label(label): counter = 0 def count(): global counter counter += 1 label.config(text=str(counter)) label.after(1000, count) count() root = tk.Tk() root.title("Counting Seconds") label = tk.Label(root, fg="dark green") label.pack() counter_label(label) button = tk.Button(root, text='Stop', width=25, command=root.destroy) button.pack() root.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 - To create a button in Tkinter please follow the below syntax. Syntax: Button(master, text="Button", command=function, options, ...)
🌐
Python Basics
pythonbasics.org › home › tkinter › tkinter buttons (gui programming)
Tkinter buttons (GUI Programming) - pythonbasics.org
To run the example, save it as button.py and run it with the python interpreter. This example opens a window, shows a button and you can click the button. ... 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 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...
🌐
Tcl Wiki
wiki.tcl-lang.org › page › tkinter.Button
tkinter.Button
command Specifies a Python callback to associate with the button.
🌐
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 ...
🌐
GitHub
github.com › Akuli › tkinter-tutorial › blob › master › buttons.md
tkinter-tutorial/buttons.md at master · Akuli/tkinter-tutorial
,---------------------------. | Button Test | _ | o | X | |---------------------------| | This is a button test. | | ,-------------. | | | Click me! | | | `-------------' | | | | | | | `---------------------------' ... import tkinter from tkinter ...
Author   Akuli
🌐
EDUCBA
educba.com › home › software development › software development tutorials › tkinter tutorial › python tkinter button
Python Tkinter Button | Guide to Python Tkinter Button with Examples
March 27, 2023 - Technically, the pack command is in the form of the method pack(). Applying this method to the variable button initiates a widget with the mentioned properties over the base widget. the base widget which is being used here could be a panel or ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Tk Tutorial
tk-tutorial.readthedocs.io › en › latest › button › button.html
Button — Tk tutorial 2020 documentation
import tkinter as tk root = tk.Tk() def callback(x): print('button', x) tk.Button(text='Button 1', command=lambda : callback(1)).pack() tk.Button(text='Button 2', command=lambda : callback(2)).pack() tk.Button(text='Button 3', command=lambda : callback(3)).pack() root.mainloop()
🌐
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 - button = tk.Button(app, text="Press Me", command=action(args)) We will introduce two ways to pass the arguments to the command function. As demonstrated in Python Tkinter tutorial, you have the option to use the partial object from the functools module.