[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] easy way to check pygame.Color() equality?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] easy way to check pygame.Color() equality?
- From: "Thiago Chaves" <shundread@xxxxxxxxx>
- Date: Mon, 12 Jan 2009 09:51:07 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 12 Jan 2009 02:51:11 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=iX2XObRd4SPcX9b1v5wMjtOAEI8Vrg5mAf5jfBC7kuI=; b=qziNsdCGFeOJpNoaigNaEI59ceoiby3uNGjBRNVg1uFeo7SCmPTfUzksHcjs/Byvl9 TrE5/NBbcHYkJPcfJFHau4EhDCHDbfqzxbn1L7hyu2VNmPI8O8j/p7BMogIxTe39jvtj 1q8hPQJM6neAxfshBA0WMspkSBTAhfR4w1+Do=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=E59ITUCLWsIprVGIfF3UI5wf9ojC3017sE47klKaR4odVYWJIiZRyr0EFQzG0X+v4Q HUBpc+vAhjLJ2ORL/b8XcoANDb0iaietmdR9p39uZk4KTLBMFf0DSUNaUxGYYU36zL+v jrbvX6zzGx5dZ69E1MTsdGPt1wHZz9uapjoxI=
- In-reply-to: <dc44bb3e0901112324q282b5f40hea232a975bc2e424@xxxxxxxxxxxxxx>
- References: <dc44bb3e0901112324q282b5f40hea232a975bc2e424@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Maybe comparing their hsva or hsla values instead?
-Thiago
On Mon, Jan 12, 2009 at 9:24 AM, 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
>