[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] easy way to check pygame.Color() equality?



On, Wed Jan 14, 2009, Jake b wrote:

> How so, or what do I need to watch? Meaning is it safe for now to do?:
> 
> if self.color == pygame.Color("red"): print 'same color!'

In the recent pygame versions you can do something like:

if color == "0xff0000": print "it's red!"

Comparing a color to a string however is something that should not give
a valid result, just as other type comparisions:

>>> "1" == 1
False

In pgreloaded you only can compare a Color object with a another Color
object.

Regards
Marcus

Attachment: pgplB0XLZCM12.pgp
Description: PGP signature