pygtk  

[pygtk] change the background image in a Pygtk table that contains a layout

Petsas Athanasios
Wed, 27 Jan 2010 07:15:06 -0800

Hello all,

I have created a gtk.Layout and I have attached it in a gtk.Table. What I
want to do is to put a background image in it, where the
widgets will be placed. How I can do this? I try the code below that change
the background image of the window, but this doesn't work on
the layout or the table. Can anybody help me on this?

Thank you in advance,
Thanasis

code:

import gtk
imagename = 'image.jpg'

win = gtk.Window()
pixbuf = gtk.gdk.pixbuf_new_from_file(imagename)
pixmap, mask = pixbuf.render_pixmap_and_mask()
width, height = pixmap.get_size()
del pixbuf
win.set_app_paintable(gtk.TRUE)
win.resize(width, height)
win.realize()
win.window.set_back_pixmap(pixmap, gtk.FALSE)
del pixmap
win.show()
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/