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
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) ...
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
(TKINTER) How would I go about closing a window right after a new Toplevel window is opened.
Don't make a new window. Just replace all of the content of the current window. This is very easy if you use Frame classes. Here's an example: https://www.reddit.com/r/learnpython/comments/10szjeh/tkinter_login/j74jupu/ More on reddit.com
🌐 r/learnpython
4
2
February 2, 2024
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
Reassigning Global Variables with Button Commands
def changevar (): var = 1 FYI, var is now a different variable (but with the same name) because it was (re)created in the function. This means that it is a local function variable and so is garbage collected when the function exits. This variable is in a different namespace, so does not affect the other variable with the same name. More on reddit.com
🌐 r/Tkinter
4
1
January 16, 2024
🌐
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 ...
🌐
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-pass-arguments-to-tkinter-button-command
How to Pass Arguments to Tkinter Button Command? - GeeksforGeeks
July 23, 2025 - # importing tkinter import tkinter ... GeekForGeeks") root.geometry("380x400") # creating button btn = tk.Button(root, text="Press", command=lambda: func("See this worked!")) btn.pack() # running the main loop root.mainloo...
🌐
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()
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 ·
🌐
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.
🌐
TutorialKart
tutorialkart.com › python › tkinter › button › command
Tkinter Button command - Call Function on Button Click
November 30, 2020 - Tkinter Button command option sets the function or method to be called when the button is clicked.
🌐
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.
🌐
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
instance = tkinter.Button(parent ... repeatdelay repeatinterval takefocus text textvariable underline wraplength · command Specifies a Python callback to associate with the button....
🌐
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.
🌐
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)
🌐
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()
🌐
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:
🌐
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, ...)
🌐
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
🌐
Python Guides
pythonguides.com › python-tkinter-button
How To Create Buttons In Python With Tkinter?
March 19, 2025 - In this tutorial, I have explained how to create buttons in Python with Tkinter. I discussed how to customize button appearance, handle button events, work with button states , and retrieve button text. I also coved Tkinter button style, button command, button command argument, button shape, button image, and button position.