adds callbacks function to a button : Event « GUI Tk « Python






adds callbacks function to a button

adds callbacks function to a button
 
import sys
from Tkinter import *
widget = Button(None, text='Hello', command=sys.exit)
widget.pack()
widget.mainloop()


           
         
  








Related examples in the same category

1.Binding an event with an event handlerBinding an event with an event handler
2.Associating arguments to an event-handler functionAssociating arguments to an event-handler function
3.Sharing Information Between Event-Handler FunctionsSharing Information Between Event-Handler Functions
4.What Events Does 'Command' Bind To?What Events Does 'Command' Bind To?
5.Add system exit action to a buttonAdd system exit action to a button
6.Update Label in action event
7.Class wrapper for GUI
8.Use lambda to generate a call back function for a buttonUse lambda to generate a call back function for a button