尝试在pygame中设置背景时,我似乎遇到了错误行nohup: redirecting stderr to stdout
我试图查找实际上是什么错误,并查看图像是否被识别但没有运气。
import pygame
import os
_image_library = {}
def get_image(path):
global _image_library
image = _image_library.get(path)
if image == None:
canonicalized_path = path.replace('/', os.sep).replace('\\', os.sep)
image = pygame.image.load(canonicalized_path)
_image_library[path] = image
return image
pygame.init()
screen = pygame.display.set_mode((400, 500))
done = False
clock = pygame.time.Clock()
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill((255, 255, 255))
screen.blit(get_image('background.jpg'), (10, 5))
pygame.display.flip()
clock.tick(60)
我希望代码显示背景图片:“ background.jpg”