"ANKUR AGGARWAL" <coolankur2...@gmail.com> wrote

I am looking for a method using Tkinter module to update the button on the
click.

Define an event handler command for the button.
Lets call it sayHi()

def sayHi(self):
    self.myButton['text'] = 'hi'
# Note:event handlers don't return results so store it as an attribute
    self.myButtonResult = 'hi'

Now create the widget with spam as the handler.

self.myButton = Button(parent, text='hello', command = spam)

That's it.

the its click should be "hi". I tried it through event handling but failed
to do so.

It would be more helpful if you posted the code that you tried
and a more detailed explanation of "failed to do so".
What happened? Did it update but not store a value?
Did you get an error message? Did anything happen?

The more specific information you provide the more likely you
are to get a specific solution that works.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to