Reputation: 441
I want to get the color value of a pixel. I have read something about a function called "pygame.Surface.get_at()". But when I use this function i get this error:
Traceback (most recent call last):
pygame.Surface.get_at(300, 200)
TypeError: descriptor 'get_at' requires a 'pygame.Surface' object but received a 'int'
Upvotes: 2
Views: 3721
Reputation: 31494
You have two problems here:
get_at
requires a tuple (x, y)
so you should invoke it with:
.get_at((300, 200))
You should provide the surface for which you want to get the pixel color. Something like this:
screen = pygame.display.set_mode((150, 50))
...
screen.get_at((300, 200))
Upvotes: 5