O
O
OccamaRazor2017-01-22 22:54:15
Python
OccamaRazor, 2017-01-22 22:54:15

How to inject scaled_image into the class itself to avoid the need for a variable?

How to inject scaled_image into the class itself to avoid the need for a variable?

class none(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(os.path.join(IMG,"ser.png")).convert()
        self.image.set_colorkey(BLACK_CELL) # made bg transparent
        self.rect = self.image.get_rect()
 
scaled_pawn = pygame.transform.scale(none().image, (70, 70))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DennyD314, 2017-01-25
@OccamaRazor

self.image = pygame.transform.scale(self.image, (70, 70))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question