pyinstaller(pygame)中的默认python解释器
我在pygame做一个关于2048的项目pyinstaller(pygame)中的默认python解释器,python,pygame,Python,Pygame,我在pygame做一个关于2048的项目 双击并通过命令提示符,程序运行正常 文件名中有一个空格:“game\u space\u board.png”。这通常会导致错误,应该避免。老实说,我不知道这是否是您问题的根本原因,但值得一试。Update!:问题似乎是pyinstaller没有正确绑定我的图像文件。但是,尽管修改了规范文件,我还是无法添加它们 class newSprite(pygame.sprite.Sprite): def __init__(self,filename):
双击并通过命令提示符,程序运行正常 文件名中有一个空格:“game\u space\u board.png”。这通常会导致错误,应该避免。老实说,我不知道这是否是您问题的根本原因,但值得一试。Update!:问题似乎是pyinstaller没有正确绑定我的图像文件。但是,尽管修改了规范文件,我还是无法添加它们
class newSprite(pygame.sprite.Sprite):
def __init__(self,filename):
if filename != "0.png":
pygame.sprite.Sprite.__init__(self)
self.images=[]
self.images.append(loadImage(filename))
print(self.images[0])
self.image = pygame.Surface.copy(self.images[0])
self.currentImage = 0
self.rect=self.image.get_rect()
self.rect.topleft=(0,0)
self.mask = pygame.mask.from_surface(self.image)
self.angle = 0
gameboard = newSprite("game board.png")
TypeError:descriptor "copy" requires a pygame.surface object but received a "Nonetype".