I am creating my first game in python and was doing it part by part. Than I got this error message:
AttributeError: \'pygame.Surface\' object has no
Because the module pygame
is shadowed by the variable pygame
that refers to the display Surface object. You have to rename the variable that holds the Surface object which is associated to the Pygame display:
pygame = pygame.display.set_mode([screen_width,screen_width])
pygame_surf = pygame.display.set_mode([screen_width,screen_width])
Note that when pygame.event.get()
is called, pygame
is understood as the Surface object pygame
and a Surface object does not have an attribute event
.