I created a class Cartel
, which inherits from pygame.surface.Surface
, to display images
class Cartel(pygame.surface.Surface):
def __init__(self,width, height,imagen):
super().__init__((width, height))
self.imagen=pygame.image.load(imagen).convert_alpha()
pantalla.blit(self,(200,180))
Although when I try using the Cartel
class the image appears in black
while True:
fon2=Cartel(300,300,"Images\circulo.png")
But this doesn't happen when I blit
an image normally, like this:
francia=pygame.image.load("Images\Francia.png").convert_alpha()
francia=pygame.transform.scale(francia, (150, 40))
francia_rect=francia.get_rect(center=(70,60))
while True:
pantalla.blit(francia,francia_rect)
I'd like to know how to blit correclty an image from my class. Thanks!