Try changing screen.blit(background(0, 0))
to screen.blit(background,(0, 0))
(without the comma, you are treating background
as a function/callable instead of as a parameter. Think of it like calling a function named background
with the argument (0, 0)
.). screen.blit
's two required arguments are a source
and a destination
, so putting a comma after background
supplies both arguments (source
is background
, destination
is (0, 0)
).
When trying to blit a background in pygame, I get this error message
Question
I'm new to pygame as of yesterday, and I keep running into this issue when trying to blit anything onto the screen. I am running mac osx 10.6.8. I am writing it all out in textwrangler, and executing it in the terminal with python2.7-32 filename.py
Traceback (most recent call last):
File "adventure.py", line 35, in <module>
screen.blit(background(0, 0))
TypeError: 'pygame.Surface' object is not callable
Here is my python program
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow