Harlin Seritt wrote:
I have the following script. Two widgets call the same function. How
can I tell inside of the called function which button called it?:

As far as I know you can't (but I can be proven wrong). You may try to define a class to solve this (not tested):

####
class say_hello:
    def __init__(self, text):
        self.text=text
    def __call__(self)
        print 'Hello!'
        print self.text

root = Tk()
button1 = Button(root, text='Button 1', command=say_hello('Button 1'))
button1.pack()
button2 = Button(root, text='Button 2', command=say_hello('Button 2'))
button2.pack()
root.mainloop()
####
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to