Answer the question
In order to leave comments, you need to log in
What's wrong? blit function in pygame: 'Rects' object has no attribute?
Explain to the old fool what's wrong. My face is already on fire, I don’t understand what’s wrong?
AttributeError: 'Rects' object has no attribute 'model'
Well, I look and see no reason, because the principles are the same.
well he writes:
hero = pg.Surface((40, 50))
hero.fill('blue')
rect = hero.get_rect()
screen.blit(hero, rect)
self.model = pg.Surface((40, 50))
self.model.fill('black')
self.rect = model.get_rect()
screen.blit(self.model, self.rect)
class Rects:
def __init(self):
self.screen = screen
self.screen_rect = screen.get_rect()
self.screen_bg_color = (123, 104, 238)
self.model = pg.Surface((40, 50))
self.model.fill('black')
self.rect = model.get_rect()
self.rect.bottom = screen_rect.bottom
self.rect.centerx = screen_rect.centerx
def update_screen(self, screen):
screen.fill((123, 104, 238))
screen.blit(self.model, self.rect)
pg.display.update()
def start():
pg.init()
pg.display.set_caption("отчание")
fpsClock = pg.time.Clock()
screen = pg.display.set_mode((screen_width, screen_height))
rects = Rects()
while True:
check_events()
rects.update_screen(screen)
fpsClock.tick(FPS)
start()
Answer the question
In order to leave comments, you need to log in
What is the new magic method
In python, their names end with two more underscores
def __init(self):
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question