Working with GUI, keep getting Attribute Error
Hello, I'm doing an assignment for my programming class and the professor isn't responding (its an online course) so I'm coming here for some guidelines rather than a solution.
Background Info: The assignment is to create a simple GUI dialogue box that calculates a users MPG within the labels based on information they provide in two boxes (gallons and miles respectively). We are to provide an error exception for negative and non-numeric inputs
What my problem is: Within the confines of the "calculate button", the interpreter is not recognizing the "calc" command I have assigned to the button. It gives me an attribute error and says that there is no attribute "calc" to my class. If you are interested in helping me I can give you a screenshot of the error as well as a file containing my code.
Thank you in advance, I'm only coming for guidelines here because my professor is not responding and my book is of no help!
tl;dr I need help because my prof sucks and I cant find an answer on google or text
Edit: I got it! My mistake was apparently indention! I had my calc() function outside of the class! lol
Posted Dec 13, 2015, 3:35 AM UTC · edited
That part where you write calc()...what if you wrote self.calc()? If this works, what did adding "self." in front of the word calc tell the interpreter, do you think?