Wrap action command in a class : Action : Tkinker PYTHON TUTORIALS


PYTHON TUTORIALS » Tkinker » Action »

 

Wrap action command in a class


Wrap action command in a class
from Tkinter import *
     
class HelloCallable:
    def __init__(self):                      
        self.msg = 'Hello __call__ world
    def __call__(self):
        print self.msg                       
        import sys; sys.exit()               
     
widget = Button(None, text='event', command=HelloCallable())
widget.pack()
widget.mainloop()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Tkinker
» Action