I having a problem with the pygame 'Spot the Difference' project. The image
'spot_the_diff.png' will not open.
The files are in the /home/pi folder. I'm able to click and open both pic flies: rpf.io/spot-pic rpf.io/scary-pic and the rpf.io/scream sound will open and play.
After clicking run the black background appears instead of 'spot_the_diff.png" and the black background remains open. Thank you.
______________________________________________________________________
Shell
________________________________________________________________________
Python 3.5.3 (/usr/bin/python3)
>>> %Run 'Sopt the Difference.py'
Traceback (most recent call last):
File "/home/pi/Python/Sopt the Difference.py", line 9, in <module>
difference = pygame.image.load('spot_the_diff.png')
pygame.error: Couldn't open spot_the_diff.png
>>>
_________________________________
pi@raspberry:~ $ cat /proc/version
Linux version 4.9.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.130-2 (2018-10-27)
import pygame
from pygame.locals import *
from time import sleep
from random import randrange
pygame.init()
width = pygame.display.Info().current_w
height = pygame.display.Info().current_h
screen = pygame.display.set_mode((width, height))
difference = pygame.image.load('spot_the_diff.png')
difference = pygame.transform.scale(difference, (width, height))
screen.blit(difference, (0, 0))
pygame.display.update()
pygame.quit()
I expect the image ('spot_the_diff.png') to briefly appear on screen. Instead the black background appears on screen and remains open.