Skip to content Skip to sidebar Skip to footer

Descriptor 'get_at' For 'pygame.surface' Objects Doesn't Apply To A 'tuple' Object

I'm creating a program and am attempting to draw a rectangle at the cursor's position if the pixel at the cursor's position isn't already black. if pygame.Surface.get_at(pygame.mou

Solution 1:

you need to call get_at on a pygame.Surface object, not the class itself.


screen = pygame.display.set_mode(size)

pixel = screen.get_at(pygame.mouse.get_pos()) #gets the pixel on the screen surface

another_surface = pygame.Surface((100, 100))

another_pixel = another_surface.get_at((50, 50)) #gets the pixel from the 'another_surface' surface


Post a Comment for "Descriptor 'get_at' For 'pygame.surface' Objects Doesn't Apply To A 'tuple' Object"