[pygtk] gtk.DrawingArea
Steve McClure
smcclure at racemi.com
Fri Feb 10 20:45:13 WST 2006
On Fri, 2006-02-10 at 10:44 +0100, Luigi Paioro wrote:
> 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?
The DrawingArea is just a pixmap, it doesn't have any children like the
Canvas. To erase the line you have to draw it again with a different gc
that uses the background color as its foreground. Of course this leads
to other problems if the line is on top of anything else you've drawn,
etc.
>
> 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
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
--
Steve McClure Racemi
email: smcclure at racemi.com 380 Interstate North Pkwy, SE
voice: 404-892-5850 Suite 250
fax: 404-892-7215 Atlanta, GA 30339
http://www.racemi.com
More information about the pygtk
mailing list