El dom, 28-11-2004 a las 13:27 -0500, Mike Eller escribi�:
>     Hi list,
>
> I am new to Python; familiar with GTK.
> I would like to implement a window where I can set an image as a
> background. Then I would like to be able to draw (lines, circles,
> squares, etc) on top of that image as needed. Right now I created the
> window and added an event box to it. To the event box I added an image
> widget and set it to an image from file. Since the image widget creates
> a pixmap by default, can I now draw on this?  If so, how do I go about
> it? If not, is there a way to implement a window, with an image (.gif)
> as a background and be able to draw to the window?
> I was thinking of trying to implement a window as a drawable and then
> adding the image widget to it (since it does not implement a window).
> Would I still be able to draw on the drawable and have it visible?
>
> Any assistance is greatly appreciated.
I'm not sure this is what you are asking for, but, instead of using a raw
window, you have gtk.DrawingArea, which can be used to draw through its
window using gtk.gdk.Drawable methods. That way you could put an image as
background using draw_pixbuf(...). (Also with your bare window).

Note that this is not a retained mode canvas (remembers graphic objects
and how to redraw or change them) but an inmediate mode one (your
application must know what is to be drawn). In the first case you should
use gnomecanvas or diacanvas.

In the FAQ entry 18.8 you have the pattern to follow when using a
DrawingArea:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq18.008.htp

Happy pygtk hacking,

Pachi




_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to