I'm currently trying to show an image onto my pygame screen but it I keep on being told that my image is not in the directory. Maybe I can be proven wrong but I'm quite confident that the image location is in the same directory, and that something must be wrong with my code and so it's not able to fetch it. The traceback error is:
FileNotFoundError: No file 'Assets\gold_star.png' found in working directory
'C:\Users\PycharmProjects\eyegame'
I've pasted the code below:
WIDTH,HEIGHT = 750,600
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Eye Reaction App !")
WHITE = (250, 250, 250)
FPS = 60
GOLD_STAR_IMAGE = pygame.image.load(
os.path.join('Assets', 'gold_star.png'))
GREEN_TRIANGLE_IMAGE= pygame.image.load(
os.path.join('Assets','green_triangle.png'))
LIGHT_BLUE_RECTANGLE_IMAGE = pygame.image.load(
os.path.join('Assets','light_blue_rectanhle.png'))
ORANGE_SQUARE_IMAGE = pygame.image.load(
os.path.join('Assets','orange_square.png'))
PURPLE_HEXAGON_IMAGE = pygame.image.load(
os.path.join('Assets','purple_hexagon.png'))
RED_CIRCLE_IMAGE = pygame.image.load(
os.path.join('Assets','red_circle.png'))
def draw_window():
WIN.fill(WHITE)
WIN.blit(GOLD_STAR_IMAGE, (300,100))
pygame.display.update()
def main():
clock = pygame.time.Clock()
run = True
while run:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
draw_window()
pygame.quit()
if __name__ == "__main__":
main()