ValueError: invalid rectstyle object Pygame

ValueError: invalid rectstyle object Pygame

正在尝试在屏幕上显示分数。我通过清除显示分数的屏幕部分然后添加新分数来完成此操作。但是,当我尝试这样做时,我不断收到此错误 "ValueError: invalid rectstyle object"。有人对如何解决这个问题有任何想法吗?

这里是所有涉及的代码:

主函数内部:

 screen.fill(WHITE,((1280/2),(720/2) - 250))
 displayText(scoreText,50,((1280/2),(720/2) - 250))

正在使用的其他功能:

def textObjects(text,font):
    textSurface = font.render('{}'.format(text),True,BLACK)
    return textSurface, textSurface.get_rect()

def displayText(text,fontSize = 100, center = ((1280/2),(720/2))):
    fontInfo = pygame.font.Font(None,fontSize)
    textSurf, textSize = textObjects(text,fontInfo)
    textSize.center = (center)
    screen.blit(textSurf,textSize)
    pygame.display.update()

我修正了它,如果有人想知道,screen.fill 中的 rect 部分没有足够的参数