bck = "C:\Python27\Lib\site-packages\back.jpg"
mse = "C:\Python27\Lib\site-packages\mouse.jpg"
import pygame, sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((600,344),0,32)
background=pygame.image.load(bck).convert()
mouse_c=pygame.image.load(mse).convert_alpha()
while True:
for event in pygame.event.get():
if event.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()
我在使用双斜杠程序时遇到此错误,但图像没有显示:File "C:\Python27\Lib\site-packages\game.py", line 12, in
background=pygame.image.load(bck).convert()
error: Couldn't open C:\Python27\Lib\site-packagesack.jpg
它似乎找不到图像
当我使用双斜杠或正斜杠时,它运行良好,但不显示图像。
我已经在多个目录中尝试过了,但仍然不起作用。在