[cairo] DrawingArea events - cross posted

Donn donn.ingle at gmail.com
Thu Nov 8 23:27:11 PST 2007


Hello,
Since I have been a visitor here and you have given me some good advice, I 
thought I'd try asking this here too; it's already on the pygtk list. It's 
not strictly anything to do with cairo, but I have to try.

I have a rudimentary app going that draws <cairo commands> down onto a 
gtk.DrawingArea. On each loop they pile up, like so many pixels.

I want to be able to bring "life" to each shape (rep by an object internally) 
such that they:
* detect mouse enter/leave
* detect mouse clicks
* detect key press

Being ill informed I wanted to ask here before I start with my first thought 
which is: Loop through each object per mouse/key event and check if the 
event.x and event.y is within it's rough bounds and if that object is not 
covered by others. A daunting task and horribly slow.

Ideally, I would like to set a "hit shape" for each active object so that it 
reacts to an accurate area rather than a general bounding circle/box.

I would appreciate any hints on how to set the ball rolling.

\d



More information about the cairo mailing list