Thanks Chris,

Yes, this works fine. However, I noticed something strange.

In the attached example, there are 9 squares. Leaving and entering the
squares on the outside border trigger both (EVT_FC_ENTER_OBJECT and
EVT_FC_LEAVE_OBJECT) events fine. However, if the mouse is on one of
the squares in the middle, it triggers EVT_FC_LEAVE_OBJECT but
not EVT_FC_ENTER_OBJECT.  Am I missing something in my code ?

Cheers,
Saeed

>
> On 7 November 2011 21:43, Chris.Barker <[email protected]> wrote:
>
>> On 11/6/11 5:54 PM, Saeed H. Al Turki wrote:
>> > I created a polygon shape using Canvas.AddPolygon as the following:
>> >
>> >
>> > H = Canvas.AddPolygon(polygon_points, LineColor = '#1A1A1A', FillColor =
>> > '#EEEE99')
>> >
>> > When I move the mouse over the 'H' shape, I trigger a function called
>> > 'colorFlash':
>> >
>> > H.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.colorFlash)
>> >
>> > My question: what is the best way to change the color of 'H' inside the
>> > 'colorFlash' function? The end goal is to have a flashing effect when
>> > mouse hover over the polygon shape in order to make it more obvious to
>> > the end user.
>>
>> Try:
>>
>> def self.colorFlash(self, obj):
>>     obj.SetFillColor(A_new_color)
>>     self.Canvas.DrawDraw(self, Force=True)
>>
>> Then you can bind to EVT_FC_LEAVE_OBJECT to change it back.
>>
>> If your drawing is complex, this may be kind of slow -- if so, put a new
>> object on top in th foreground, instead of changing the color.
>>
>> If that doesn't work, post a small self-contained example, and we'll
>> figure it out.
>>
>> -Chris
>>
>>
>>
>>
>> > Thanks.
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > FloatCanvas mailing list
>> > [email protected]
>> > http://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://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
>>
>
>

Attachment: rect.py
Description: Binary data

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

Reply via email to