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.

Leave a Comment

tech