Why am I Getting Attributeerror: Object Has No Attribute

Why am I getting AttributeError: Object has no attribute?

Your indentation is goofed, and you've mixed tabs and spaces. Run the script with python -tt to verify.

AttributeError: '...' object has no attribute '...'

In the ticket class you are trying to assign new instance attributes from methods that don't exist.

Try removing the self from the assignments in the ticket constructor.

Like this:

class ticket(object):

counter = 2000

def __init__(self):
self.name = 'Ticket'
self.tc = ticketCreation() # ticketCreation constructor has parameters.
self.sr = supportResponse() # supportResponse class does too
self.pc = callPassword()

AttributeError: '' object has no attribute ''

Your NewsFeed class instance n doesn't have a Canvas attribute. If you want to pass the Canvas defined in your Achtergrond class instance hoofdscherm to n, you can define it under the class definition for NewsFeed using __init__():

class NewsFeed ():
def __init__(self, canvas):
self.canvas = canvas
...

Then when you initialize your NewsFeed object as n, you can pass the Canvas instance from your Achtergrond class instance hoofdscherm:

n = NewsFeed(hoofdscherm.canvas)

This is a solution to your current issue, but there are other errors in your code that you can see once you modify it.



Related Topics



Leave a reply



Submit