1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| def set_window_background(self , image):
if (os.path.exists(image)):
pixbuf = gtk.gdk.pixbuf_new_from_file(image)
else:
image = '/usr/share/adesk/data/bg.jpg'
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(image,gtk.gdk.screen_width(), gtk.gdk.screen_height())
pixbuf = pixbuf.scale_simple(gtk.gdk.screen_width(), gtk.gdk.screen_height(), gtk.gdk.INTERP_BILINEAR)
pixmap, mask = pixbuf.render_pixmap_and_mask()
# width, height = pixmap.get_size()
self.window.set_app_paintable(True)
self.window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
self.window.realize()
self.window.window.set_back_pixmap(pixmap, False)
self.window.move(0,0)
del pixbuf
del pixmap |
Partager