我正在尝试为游戏创建世界地图,但是当我尝试将世界地图加载到屏幕时,命令行告诉我我无法这样做。这是代码:
import sys
import pygame
from pygame.locals import *
pygame.init ()
Surface = pygame.display.set_mode ((1000, 775), 0, 32)
pygame.display.set_caption('World Map')
WorldMap = pygame.image.load('WorldMap.jpg')
white = (255, 255, 255)
while True:
Surface.fill (white)
Surface.blit (WorldMap, (900, 675))
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit ()
sys.exit (0)
pygame.display.update()
错误看起来像这样----
Traceback (most recent call last)
File "C:\Users\The Folder\WorldMap.py", line 9, in <module>
WorldMap = pygame.image.load ('WorldMap.jpg')
pygame.error: Couldn't open WorldMap.jpg