[pygtk] DrawingArea and mouse events

Donn donn.ingle at gmail.com
Fri Nov 9 16:10:57 WST 2007


Hello,
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 are rather than a general bounding circle/box.

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

\d


More information about the pygtk mailing list