Answers for "how do I pass the button instance itself tkinter"

3

tkinter button command with arguments

# One way is to use lambda
button = tk.Button(root, text="Button", command=lambda: func(args))
Posted by: Guest on October-29-2020
4

tkinter button command with arguments

from functools import partial
#
#
def function_name(arg1):
    print(arg1)
#
#tkinter codes for GUI
#
buttonExample = tk.Button(main, text="Button", command=partial(function_name, argument1))
Posted by: Guest on July-08-2020

Code answers related to "how do I pass the button instance itself tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language