How to get the name of a button tkinter python
You can pass the number to the callback function with lambda:
import tkinter as tkdef f(name): print ("Frame:", frm.winfo_children()) print(name)root = tk.Tk()frm = tk.Frame(root)for i in range (0, 3): bt = tk.Button(frm, text = str(i), name = str(i), command = lambda i=i: f(str(i))) bt.pack()frm.pack()root.mainloop()