Apr-15-2020, 06:41 PM
Hello guys,
I am new python learner. Today I meet one attribute error. I am not sure why it happens.Please advise.Please refer the code and screenshot below.
Thanks in advance.
![[Image: c893fa?filename=1586975832641_python+que...height=801]](https://Jinliang-gmail.tinytake.com/media/c893fa?filename=1586975832641_python+question.png&sub_type=thumbnail_preview&type=attachment&width=1200&height=801)
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# Error message
I am new python learner. Today I meet one attribute error. I am not sure why it happens.Please advise.Please refer the code and screenshot below.
Thanks in advance.
![[Image: c893fa?filename=1586975832641_python+que...height=801]](https://Jinliang-gmail.tinytake.com/media/c893fa?filename=1586975832641_python+question.png&sub_type=thumbnail_preview&type=attachment&width=1200&height=801)
#++++++++++++++++++++++++++++++++++++++++++++++++++++
from tkinter import * class BuckysButtons: def __init__(self, master): frame = Frame(master) frame.pack() self.printButton = Button(frame, text="Print Message", command=self.printMessage) self.printButton.pack(side=LEFT) self.quitButton = Button(frame, text="Print Message", command=self.quit) self.quitButton.pack(side=LEFT) def printMessage(self): print("wow, this actually worked") root = Tk() b = BuckysButtons(root) root.mainloop() # windows looping does not disappear#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Error message
Error:Traceback (most recent call last):
File "H:/Knowledge/Python/Python Practice/Python/TKinter.py", line 84, in <module>
b = BuckysButtons(root)
File "H:/Knowledge/Python/Python Practice/Python/TKinter.py", line 77, in __init__
self.quitButton = Button(frame, text="Print Message", command=self.quit)
AttributeError: 'BuckysButtons' object has no attribute 'quit'
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++