0

I've got this code running at the end of a longer python3 program:

pygame.init()

size = width, height = 1920, 1080
black = 0, 0, 0

screen = pygame.display.set_mode(size)

scoreboard = pygame.image.load("scorebug.png")
scoreboardrect = scoreboard.get_rect()

screen.fill(black)
screen.bilt(scoreboard, scoreboardrect)
pygame.display.flip()

When I run this, I get the error message pygame.surface object not callable. Any suggestions?

1 Answers1

0

I am not completely sure what went wron here (due to the lack of more information on error), but I have some guesses. Also, I'm going to guess the code you wrote above is not the entire code, because you didn't import pygame. So you if you ran tthe code above, a probable reason that you got this error (I think) is because of the incorrect usage of blit(). Remember, blit() is used like this:

window.blit(Surface, (x, y))

(x, y) is also called dest, correct that if I'm wrong. However, you gave it a tuple with 4 indexes, which would be this:

(0, 0, scoreboardrect.get_size()[0], scoreboardrect.get_size()[1]

You can fix this by instead of doing

 scoreboardrect = scoreboard.get_rect()

just simply blit it at the location of (0, 0)

screen.blit(scoreboard, (0, 0))

However, this may not the right answer possbly because you did not include all of your code (where's the while loop? Is the code contained by the while loop? If so then why did you initialize pygame there? Try to include more code.) Or perhaps my solution is incorrect. Tell me nif this works.

Ethanol
  • 370
  • 6
  • 18