H
Harlin Seritt
I have the following script. Two widgets call the same function. How
can I tell inside of the called function which button called it?:
def say_hello():
print 'hello!'
print widget['text']
root = Tk()
button1 = Button(root, text='Button 1', command=say_hello)
button1.pack()
button2 = Button(root, text='Button 2', command=say_hello)
button2.pack()
root.mainloop()
Thanks,
Harlin Seritt
can I tell inside of the called function which button called it?:
def say_hello():
print 'hello!'
print widget['text']
root = Tk()
button1 = Button(root, text='Button 1', command=say_hello)
button1.pack()
button2 = Button(root, text='Button 2', command=say_hello)
button2.pack()
root.mainloop()
Thanks,
Harlin Seritt