'Unable to use Variables from __init__ method in another method of the same class [closed]
class Window:
def __int__(self, width, height, fps):
self.width = width
self.height = height
self.fps = fps
self.screen_size = (self.width, self.height)
def set_window(self):
global screen, screen_rect
screen = pygame.display.set_mode(self.screen_size)
screen_rect = screen.get_rect()
return screen, screen_rect
But I am Getting this error: AttributeError: 'Window' object has no attribute 'screen_size'
Solution 1:[1]
correct __int__ to __init__ and it should work...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hiten Tandon |
