import os import sys import pygame def load_image(name, x, y): fullname = os.path.join(name) if not os.path.isfile(fullname): print(f"Файл с изображением '{fullname}' не найден") sys.exit() image = pygame.image.load(fullname) image = pygame.transform.smoothscale(image, (x, y)) return image class FrogsInBook(pygame.sprite.Sprite): def __init__(self, img, x, y, *group): super().__init__(*group) self.image = load_image(img, 34, 34) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y