Consider the attached program. On my system (XP), the first print is True
(bgColor == wx.Colour(49, 106, 197)) but the second statement
(hash(bgColor) == hash(wx.Colour(49, 106, 197))) is False. Aren't the hash
values supposed to be equal when the items are equal?
The hash will only be equal if wx.Colour defines its __hash__ as a
function of its content. More likely is that __hash__ just isn't
defined, so the hash(color) is the same as id(color); which is the
default hash.
If you really want your colors to match up, don't use wx.Colour, use a
tuple (49,106,197). I believe that most places which would take a
wx.Colour would also take a 3-tuple instead, but I could be wrong (I
don't deal with colors much).
Consider the attached program. On my system (XP), the first print is True
(bgColor == wx.Colour(49, 106, 197)) but the second statement
(hash(bgColor) == hash(wx.Colour(49, 106, 197))) is False. Aren't the hash
values supposed to be equal when the items are equal?
If you really want your colors to match up, don't use wx.Colour, use a
tuple (49,106,197). I believe that most places which would take a
wx.Colour would also take a 3-tuple instead,