def set_xpm(w, xpm): c = w.children() if c: c[0].destroy() if not xpm: return None pixmap, mask = gtk.create_pixmap_from_xpm_d(w, None, xpm) pixmap = gtk.GtkPixmap(pixmap, None) w.add(pixmap) pixmap.show() return pixmap
def __init__(self): window = gtk.Window() window.show() # Now for the pixmap and the pixmap widget style = window.get_style() gdk_pixmap, mask = gtk.create_pixmap_from_xpm_d( window.get_window(), style.bg[gtk.STATE_NORMAL], WheelbarrowFull_xpm) pixmap = gtk.Pixmap(gdk_pixmap, mask) pixmap.show() # To display the pixmap, we use a fixed widget to place the pixmap fixed = gtk.Fixed() fixed.set_usize(400, 400) fixed.put(pixmap, 100, 100) window.add(fixed) window.set_background(gtk.gdk.Color(red=0, green=0, blue=0, pixel=0)) fixed.show()
def __init__(self): window = gtk.Window(gtk.WINDOW_POPUP) window.show() # Now for the pixmap and the pixmap widget style = window.get_style() gdk_pixmap, mask = gtk.create_pixmap_from_xpm_d( window.get_window(), style.bg[gtk.STATE_NORMAL], WheelbarrowFull_xpm) pixmap = gtk.Pixmap(gdk_pixmap, mask) pixmap.show() # To display the pixmap, we use a fixed widget to place the pixmap fixed = gtk.Fixed() fixed.set_usize(200, 200) fixed.put(pixmap, 0, 0) window.add(fixed) fixed.show() # This masks out everything except for the image itself window.shape_combine_mask(mask, 0, 0)
def _get_logo(colormap): import gtk pix, mask = gtk.create_pixmap_from_xpm_d(colormap, None, _python_image) return gtk.GtkPixmap(pix, mask)