[Tkinter-discuss] Recognizing buttons
michael.odonnell at uam.es
Sun Aug 15 10:08:16 CEST 2010
> Is it possible to have a set of buttons, all calling to the same function, recognize which of the buttons was the one that call the function?
One solution to your problem, using lambda to define the function call.
from Tkinter import *
tk = Tk()
but1['command']=lambda b=but1: killBut(b)
but2['command']=lambda b=but2: killBut(b)
On Sun, Aug 15, 2010 at 4:06 AM, Guido Carballo-Guerrero <charras at me.com> wrote:
> 'Cause what I want to do, is create a set of buttons, where I will not know how many buttons will be created, that will depend on the input of the user. Once the user have this, he will click one of those buttons, and depending on which button was press, the program will erase that part of the input that the operator gave.
> Guido Carballo
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
More information about the Tkinter-discuss