[pygtk] gtk.DrawingArea

Luigi Paioro luigi at lambrate.inaf.it
Fri Feb 10 17:44:33 WST 2006


Thank you John.

I solved looking in the FAQ! It was only that I have to use

self.area.set_events(gtk.gdk.POINTER_MOTION_MASK)

instead of

self.area.set_events(gtk.gdk.POINTER_MOTION_MASK |
                      gtk.gdk.POINTER_MOTION_HINT_MASK )

Thanks a lot.

Now I have another question that I can't solve.

While I can draw a line on a gtk.gdk.Drawable object, it looks that I 
cannot delete it. For example I can draw a line using:

area = gtk.DrawingArea()
area.window.draw_line(gc, x1, y1, x2, y2)

but I cannot delete such line... a line isn't identified by an object or 
an ID and it doesn't exist a proper method to delete it!

Is there a trick to solve this trouble?

Thanks again.

Luigi


John Pye wrote:
> Hi,
> 
> I don't know if this is the solution but it sounds similar to a problem
> that I had. I had a gtk.Image inside a viewport inside a scrolling
> window. In order to capture the 'motion-notify-event' on my gtk.Image, I
> needed to add an EventBox on the image, and capture the events to that.
> I used Glade to do that, and it worked fine. Have you tried an EventBox yet?
> 
> There was something in the PyGTK FAQ about this.
> 
> Cheers
> JP


More information about the pygtk mailing list