Python Pygame组更新不接受任何参数

Python Pygame组更新不接受任何参数,python,pygame,typeerror,Python,Pygame,Typeerror,我在其他地方读到过类似的问题,但它说的只是在函数定义中添加“self”。当我检查文件时,它是self,它实际上已经有self关键字了!以下是回溯: Traceback (most recent call last): File "C:\Users\Brenda\Documents\The Nick Folder\Mobile Fortress War 3\MFWRT3 - TileClass test\Title.pyw", line 142, in <module> S

我在其他地方读到过类似的问题,但它说的只是在函数定义中添加“self”。当我检查文件时,它是self,它实际上已经有self关键字了!以下是回溯:

Traceback (most recent call last):
  File "C:\Users\Brenda\Documents\The Nick Folder\Mobile Fortress War 3\MFWRT3 - TileClass test\Title.pyw", line 142, in <module>
    SelectServer.main()
  File "C:\Users\Brenda\Documents\The Nick Folder\Mobile Fortress War 3\MFWRT3 - TileClass test\SelectServer.pyw", line 44, in main
    Main.mainloop()
  File "C:\Users\Brenda\Documents\The Nick Folder\Mobile Fortress War 3\MFWRT3 - TileClass test\Main.pyw", line 72, in mainloop
    globals.alltiles.update()
  File "C:\Python32\lib\site-packages\pygame\sprite.py", line 462, in update
    s.update(*args)
TypeError: update() takes no arguments (1 given)

有人能帮忙吗?

如果没有调试代码,这将是一个猜谜游戏,但为了将来参考,精灵组是这样创建的:

#first create a sprite class
class Card(pygame.sprite.Sprite):
    def __init__(self,img,pos):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(os.path.join('img','cards', img))
        self.rect = self.image.get_rect()
        self.rect.center = pos

#then create a group
mycards = pygame.sprite.Group()

#then add a sprite to the group
holders.add(Card('ace_spade.jpg',coord))

我有点晚了,但可能是因为每张卡的更新方法声明不正确(我假设它是pygame.sprite.sprite的子类)


应该将其声明为“def update(self)”而不是“def update()”

如果不向其传递参数,会发生什么?
#first create a sprite class
class Card(pygame.sprite.Sprite):
    def __init__(self,img,pos):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(os.path.join('img','cards', img))
        self.rect = self.image.get_rect()
        self.rect.center = pos

#then create a group
mycards = pygame.sprite.Group()

#then add a sprite to the group
holders.add(Card('ace_spade.jpg',coord))