[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] easy way to check pygame.Color() equality?
- To: pygame-users@xxxxxxxx
- Subject: [pygame] easy way to check pygame.Color() equality?
- From: "Jake b" <ninmonkeys@xxxxxxxxx>
- Date: Mon, 12 Jan 2009 01:24:46 -0600
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 12 Jan 2009 02:24:49 -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:mime-version:content-type; bh=CfnF3NfOfCy3oE+UfFVM63h6jgzY7IUxDBqaaaXvY3g=; b=JBJuIeg1Qygj19zbiLI9xow5XRm3FxNBuSmUTsKyNRptZ37yMG1oiLTG6d1+ms/BWG aHohrsvvzpozHwo8o+9t5CZ3be18H6Dbyc/DfhXTFmpvIPPiL73YHPU7s2jcnIVFK12v uI5pnKPwdtRDfCfEH00pfBEL9QtV6iAKhmJG0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=EBxGIBugOC1+y3FHdBE0rw9BEBL/a20zmHv4+zYBkugnlicWgsLGRpvArUTF7OEPjw rKrX9j2OEaqvG/wvsLDHGc7Qc3nQ+E30JYXMQMKhRSsCloviAhWZQy6/mNxbLtHIz72l AvrxV8ZrqIWfIeTLDsWS75O2w2zA8QN6sRZRw=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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