> Hola Pachi,
> Thanks for the response. I understand what you are saying. I have one
> more question before I dive into this. How do I load an image of type
> .gif as a pixmap. I thought pixmap was only two colors? And then do I
> set it as the background of the drawingarea? The window? or what? I did
> not see a "set background image" function/method in the API.
>
> Gracias,
> Mike
>
1) pixbufs can load a wide range of image formats as stated in
http://pygtk.org/pygtk2reference/class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file
(have a look at gtk.gdk.Pixbuf, gtk.gdk.Pixmap and gtk.gdk.Drawable in the
reference and read carefully their descriptions)

2) you want to use the DrawingArea's window. The window "is" a drawable a
DrawingArea "has" in it. So you can use all gtk.gdk.Drawable methods with
such window.

3) think of the gtk.gdk.DrawingArea child window as a piece of paper on
which you draw. The difference with a true canvas (or at least with what
most people think is a canvas widget) lies in the lack of information
about the model being represented, while a canvas has a record of the
objects and their relevant properties to be able to render them. So, in a
drawing area, if you draw a pixbuf and then draw some lines onto it that
is exactly what you get, a background image and some lines onto it. Forget
about background, foreground, layers, etc... this is much simpler. You
draw as you would do on a piece of paper.

Thus, a background image would be the first image drawn on the DrawingArea
(window).

An interesting pattern that may interest you is double buffering. With
this you use an offscreen image (a drawable) to draw onto and then you put
set that image as the contents of the drawing area. Also, you could ovelay
that image transparently on another one (a "background") on the
drawingarea.


Hope this helps a bit more...

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