On Tue, Mar 4, 2014 at 8:37 AM, Nouvelle Collection <
[email protected]> wrote:

> When using FC_MOTION event, associated on a ScaledBitmap, like tihs :
>
> A = self.Canvas.AddScaledBitmap(img, (x,-y), Height=img.GetHeight(),
> Position = 'tl')
> A.Bind(FloatCanvas.EVT_FC_MOTION, self.OnMotion)
>
> I get this error :
>
> Traceback (most recent call last):
>   File "D:\temp\test.py", line 30, in Test
>      A.Bind(FloatCanvas.EVT_FC_MOTION, self.OnMotion)
>   File "D:\temp\floatcanvas\FloatCanvas.py", line 286, in Bind
>     self._Canvas.HitDict[Event][self.HitColor] = (self) # put the object
> in the hit dict, indexed by its color
> KeyError: 10320
>
>
Do you have any idea why FC_MOTION brings a KeyError, related on color ? I
> didn't use any color at all for A.
>

I don;'t know why there is an error -- I'll see if I can look into that.

But the KeyError related to color is because FloatCanvas uses colors to do
hit testing:

each object is drawn to an off-screen bitmap in a unique color. When there
is a mouse event, the color of the pixel under the mouse is checked to see
what object is there. self.HitColor is the unique color of that object
(unrelated to the color drawn to teh screen for the user (if any).

I actually think that the key error there is Event, rather than the
HitColor -- perhaps I forgot to add FC_MOTION to the HitDict....

-Chris







> Thanks a lot in advance,
>
> Jo
>
>
> _______________________________________________
> FloatCanvas mailing list
> [email protected]
> http://mailman.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mailman.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to