0

I'm learning pygame and when i reached the set icon part,i was unable to do it it kept giving me an error that no such file found in directory i dont know how to put the full path of the image either help Here is the code:

import pygame

pygame.init()

screen = pygame.display.set_mode((800, 600))


#Title and screen
pygame.display.set_caption("Practice")
icon = pygame.image.load('monitor.png')
pygame.display.set_icon(icon)


#Game Loop
running = True
while running:
  for event in pygame.event.get():
     if event.type == pygame.QUIT:
        running = False

And here is the error:

icon = pygame.image.load('monitor.png')
FileNotFoundError: No such file or directory.
  • Make sure that monitor.png is in the same folder as your Python Script. If it's not, give the full path to the image. – PianoPianist Jun 07 '21 at 11:53

0 Answers0