hi,
I think that should work... and does in fact work for me...
r = pygame.Color("red")
r == pygame.Color("red")
True
Maybe it is your pygame version? What version do you have? I'm using
pygame 1.9.0pre (from subversion). The color class changed in pygame
1.8.1.
import pygame
print pygame.version.ver
Also, note that you might want to compare to color thresholds, or
weights... which is what the pygame.transform.threshold and
pygame.PixelArray.compare functions are for. If you don't want to
compare exact colors, but colors within a certain range.
cheers,
On Mon, Jan 12, 2009 at 6:24 PM, Jake b <ninmonkeys@xxxxxxxxx> wrote:
How do I check for color equality?
r = pygame.Color("red")
r == pygame.Color("red")
returns False # expected True, since I don't care if they are the same
instance of a Color() class
I thought it would be an equality test., like this: [ The print out has
equivalent values. ]
def ceq(c1,c2):
return c1.r == c2.r and c1.g == c2.g and c1.b == c2.b and c1.a == c2.a
--
Jake