[pygtk] Drawing over a scrolled image

A.T.Hofkamp a.t.hofkamp at tue.nl
Mon Sep 14 14:53:44 WST 2009


Fabrice DELENTE wrote:
> Hello.
> 
> I'm trying to draw over a scrolled image; my image is loaded as a gtk.image
> in a scrolled window in which I added a viewport; this works ok.
> 
> As I need to draw over this image, I tried to add a gtk.DrawingArea to the
> gtk.Image, but as gtk.Image is not a container it can't work...

I think you have two options:
a. Modify the image before displaying it.
b. Don't use a gtk.Image widget.

As for the second option, if you want more than just displaying an image, 
gtk.Image is not what you want to have. Instead, use a gtk.DrawingArea in the 
viewport, and draw the image onto the DrawingArea.window . However, since a 
DrawingArea allows arbitrary drawing operations in arbitrary order, you are 
free to add more lines etc after rendering the image.

> Is there a way to manage this with a scrolled window and a viewport? Or do I
> have to implement the scrolling myself with an hscrollbar and a vscrollbar?

That should not be needed.


Albert



More information about the pygtk mailing list