from Tkinter import *
class Application (Frame): #application class extends frame from tkinter which means it gets methods from tkinter but can do everything a tkinter fram can do
def __init__(self, master): # Initialization is a constructor method
Frame.__init__(self,master) #This is the frame of the button itsself
self.grid() #This is container widget for the
self.button_clicks =0 # For counting number of button clicks
self.create_widgets() # create the button that counts
def create_widgets(self): # define what the button will do
self.button= Button(self) # when you type in Button, it will mean self.button
self.button["text"] = "Click here if this changes your view on recycling at SAS" #This is what will print on the GUI
self.button["command"] = self.update_count #This is the actual counter on the button itsself.
self.button.grid() # Put on grid so it shows up
def update_count(self): # To increase the count when the button is clicked
self.button_clicks +=1 # Each click of the button adds 1
self.button["text"] = "Click here if this changes your view on recycling at SAS" + str(self.button_clicks) #This combines the last two codes to work together
root = Tk() # Line is necessary for buttons to appear
root.title("repsychology") # Gives the title of the GUI
root.geometry("200x200") # Size of text box for the button
app = Application(root) #Create the application
root.mainloop() #In order for button process to repeat