0
votes

Trying to display a score on a screen. I'm doing it by clearing the section of the screen that displays the score then adding the new score in. However when I'm trying to do this i keep getting this error "ValueError: invalid rectstyle object". Anyone have any ideas on how to fix this?

Here's all the code involved:

inside the main function:

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

Other functions in use:

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()
1

1 Answers

0
votes

I fixed it if anyone was wondering, there wasn't enough arguments in screen.fill for the rect part