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 Posts:
- How can I create an object and add attributes to it?
- Creating a static class with no instances
- How to print instances of a class using print()?
- Python dictionary from an object’s fields
- PermissionError: [Errno 13] Permission denied
- Saving and loading objects and using pickle
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ImportError: No module named ‘Tkinter’
- Are static class variables possible in Python?
- How to pip or easy_install tkinter on Windows
- matplotlib error – no module named tkinter
- tkinter gui with progress bar
- filedialog, tkinter and opening files
- How can I create a dropdown menu from a List in Tkinter?
- How do I insert a JPEG image into a python Tkinter window?
- Does Python have “private” variables in classes?
- TypeError: generatecode() takes 0 positional arguments but 1 was given
- Tkinter understanding mainloop
- takes 1 positional argument but 2 were given
- How to pass arguments to a Button command in Tkinter?
- Tkinter scrollbar for frame
- Tkinter understanding mainloop
- matplotlib error – no module named tkinter
- Python calling method in class
- Difference between ‘cls’ and ‘self’ in Python classes?
- AttributeError: ‘datetime’ module has no attribute ‘strptime’
- How do you call an instance of a class in Python?
- List attributes of an object [duplicate]
- How to extend a class in python?
- How to implement a binary search tree in Python?
- How to use an image for the background in tkinter?
- How to update a plot in matplotlib?
- Using __add__ operator with multiple arguments in Python
- Function to close the window in Tkinter
- Python function overloading
- Windows- Pyinstaller Error “failed to execute script ” When App Clicked
- super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object
- How do I determine the size of an object in Python?
- Using Tkinter in python to edit the title bar
- Difference between import tkinter as tk and from tkinter import
- Accessing a class’ member variables in Python?
- Disable / Enable Button in TKinter
- How to clear Tkinter Canvas?
- How to handle a Button click event
- tkinter gui layout using frames and grid
- Tkinter error: Couldn’t recognize data in image file
- Strange Exception in Tkinter callback
- How do I compile my Python 3 app to an .exe?
- SyntaxError: unexpected EOF while parsing
- How do I lowercase a string in Python?
- How do I copy a file in Python?
- How can I reverse a list in Python?
- Manually raising (throwing) an exception in Python
- How do I copy a file in Python?
- can’t multiply sequence by non-int of type ‘float’
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- How to use the pass statement
- How to use filter, map, and reduce in Python 3
- What does enumerate() mean?
- Searching the student-t distribution table for values using python
- How to declare an array in Python?
- Does Python have a ternary conditional operator?
- Use Gif Logo For Loading Screen In Kivy
- Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked
- Pig Latin Translator
- What is the difference between Python’s list methods append and extend?
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- TypeError: ‘int’ object is not subscriptable
- sphinx.ext.autodoc: Keeping names of constants in signature
- are there dictionaries in javascript like python?
- How do you round UP a number?
- Understanding slice notation
- Iterating over dictionaries using ‘for’ loops
- How to define a two-dimensional array?
- how to sort pandas dataframe from one column
- Why am I seeing “TypeError: string indices must be integers”?
- How do you round UP a number?
- Understanding slice notation
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How do I update\upgrade pip itself from inside my virtual environment?
- How to open a file using the open with statement
- How to emulate a do-while loop?
- How do I update\upgrade pip itself from inside my virtual environment?
- How to comment out a block of code in Python [duplicate]
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
- Using “with open() as file” method, how to write more than once? [duplicate]
- TypeError: list indices must be integers or slices, not str
- Why there is no do while loop in python
- How do I get a substring of a string in Python?
- How do I sort a dictionary by value?
- ImportError: DLL load failed: The specified module could not be found
- How do I sort a dictionary by value?
- How to prettyprint a JSON file?
- What does the “yield” keyword do?
- ImportError: DLL load failed: The specified module could not be found
- Replacements for switch statement in Python?
- How to install pip with Python 3?