Python attribute button error
Question: Hey guys im just trying to create a simple button gui (absolute n00b ) but i
can seem to figure out whats wrong with my code:

    
    
    ``__author__ = 'Isaac'
    
    from Tkinter import *
    
    class Application(Frame):
    """ My smart board application"""
    def __init__(self, master):
        Frame.__init__(self, master)
        self.grid()
        self.create_widgets()
    
    def create_widgets(self):
    #Button1
        self.button1 = Button(self, text = "Calandar")
        self.button1.grid()
    
    #button2
        self.button2 = Button(self)
        self.button2.grid()
        self.button.configure(text = "Weather")
    root = Tk()
    root.title("Smartboard")
    root.geometry("500x400")
    
    app = Application(root)
    
    root.mainloop()
    

the error im getting is:

    
    
    C:\Python27\python.exe "C:/Users/Isaac/Desktop/Useful     python/Clanadar/GUIOOP.py"
    Traceback (most recent call last):
     File "C:/Users/Isaac/Desktop/Useful python/Clanadar/GUIOOP.py", line 25, in <module>
    app = Application(root)
    File "C:/Users/Isaac/Desktop/Useful python/Clanadar/GUIOOP.py", line 11, in __init__
    self.create_widgets()
    File "C:/Users/Isaac/Desktop/Useful python/Clanadar/GUIOOP.py", line 20, in      create_widgets
    self.button.configure(text = "Weather")
    AttributeError: Application instance has no attribute 'button'
    
    Process finished with exit code 1
    

thanks for your help


Answer: Under your "#button2" comment;3 lines below, you used

    
    
        self.button.configure()
    

However there is no variable called "button". I think you meant to say:

    
    
        self.button2.configure()
    

