-1
import pygame, sys
from pygame.locals import *

pygame.init()

window = pygame.display.set_mode((640,360),0,32)
pygame.display.set_caption("My game.")

black = [0,0,0]
white = [255,255,255]

img = pygame.image.load("images/bg.jpg").convert_aplpha() # This is where I get the error.

我得到的错误是img = pygame.image.load("images/bg.jpg").convert_aplpha() AttributeError: 'pygame.Surface' object has no attribute 'convert_aplpha' 拜托,这是什么意思,我该如何解决?

4

1 回答 1

1

convert_aplpha()根本不是函数,也不是属性。也许你的意思是convert_alpha()

# wrong
img = pygame.image.load("images/bg.jpg").convert_aplpha()
# right
img = pygame.image.load("images/bg.jpg").convert_alpha()
于 2013-05-27T22:47:56.307 回答