0

在 Mac OSX 10.8.4 上更新 SDL 框架以修复 Mac 上的全屏问题后,我的图像不再加载。大多数情况下只看函数的顶部。

def load_image(name, colorkey=None):
    fullname = os.path.join('images',name)
    try:
        image = pygame.image.load(fullname)  # Tries loading image
    except pygame.error, message:            # If image load fails
        print "Cannot load image: ", fullname# return error to console
        raise SystemExit, message
    image = image.convert_alpha()            


    if colorkey is not None: 
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)#new alpha value
    return image, image.get_rect()

这在更新之前有效,但不再有效。尝试搜索甚至再次更新无济于事。我也试过...

fullname = os.path.join(os.sep, 'images',name)

...然后一张图片有效,然后第二张无效。所有文件夹和图像名称都经过三倍检查。我什至更改了名称和文件夹仍然没有运气。还有其他想法吗?

编辑:当我提到不加载图像时,我的意思是错误命令激活。还通过运行 os.getcwd 检查了正确的目录。

4

0 回答 0