我一直在关注newbostons Game developement Tutorials,我在运行代码时遇到错误:
bif = "bg.jpg"
mif = "ball.png"
import pygame, sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((400,300),0,32)
background = pygame.image.load(bif).convert()
mouse_c = pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.event.get():
if evenet.type == QUIT:
pygame.quit()
sys.exit()
screen.blit(background, (0,0))
x,y = pygame.mouse.get_pos()
x -= mouse_c.get_width() / 2
y -= mouse_c.get_height()/2
screen.blit(mouse_c,(x,y))
pygame.display.update()
我得到错误:
Traceback (most recent call last):
File "bucky.py", line 11, in <module>
background = pygame.image.load(bif).convert()
pygame.error: Couldn't open bg.jpg
我已经保存了谷歌图片中的图片,并将其命名为bg.jpg,所以我不知道是什么导致了这个问题。如果有人可以帮助我,那就太好了。感谢