Object has no attribute | pygame(alien invasion) : learnpython
www.reddit.com › r › learnpythonimport pygame from settings import Settings from ship import Ship import game_functions as gf from pygame.sprite import Group def run_game(): # 1 # initialize game and create a screen object pygame.init() ai_settings = Settings() # create an instance of Settings and store it in ai_settings after making the call to pygame.init() screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height)) # use attributes of ai_settings # screen = pygame.display.set_mode((1100, 800 ...
Python: AttributeError: 'Settings' object has no attribute ...
stackoverflow.com › questions › 50043285Apr 26, 2018 · I have problem with AttributeError: 'Settings' object has no attribute 'screen'. Please help me, code below: class Settings (): def __init__ (self): self.screen_width=1200 self.screen_height=800 self.bg_color= (230,230,230) import sys import pygame from settings import Settings def run_game (): pygame.init () ai_settings=Settings () screen=pygame.display.set_mode ( (ai_settings.screen_width,ai_settings.screen.height)) pygame.display.set_caption ("Inwazja obcych") while True: screen.