Well, if you wanted to use it as a way to manage memory better, you could do something like this:
class my_application(object):
def __init__(self):
"""This function is called for each my_application instance initiated.
Do any window initiation here."""
self.my_widget = 0
self.my_control = 1
self.my_window = 2
self.my_button = 3
self.button_is_clicked = False
print "Window Opened"
def click_button(self):
"""This method could be called whenever the button in the window is clicked.
Do any button handling or response routines here."""
if self.button_is_clicked:
print "Button is already clicked!"
else:
print "Button clicked!"
self.button_is_clicked = True
if __name__ == '__main__':
my_program = my_application()
my_program.click_button()
my_program.click_button()