def _set_background_image(self, container, image):
themed_image = self._theme_image(image)
img = gtk.gdk.pixbuf_new_from_file(themed_image)
def draw_background(widget, ev):
alloc = widget.get_allocation()
pb = img.scale_simple(alloc.width, alloc.height,
gtk.gdk.INTERP_BILINEAR)
widget.window.draw_pixbuf(
widget.style.bg_gc[gtk.STATE_NORMAL],
pb, 0, 0, alloc.x, alloc.y)
if (hasattr(widget, 'get_child') and
widget.get_child() is not None):
widget.propagate_expose(widget.get_child(), ev)
return False
container.connect('expose_event', draw_background)
评论列表
文章目录