[pygtk] Setting a custom pitmap on a stock icon
Jeffrey Barish
jeff_barish at earthlink.net
Sat Sep 8 03:54:20 WST 2007
I created a stock icon. It works fine using the default bitmap. Now I
would like to set the bitmap for the stock item when it is rendered at a
specific size. Here is the code that I am using:
pb = gtk.gdk.pixbuf_new_from_file(icon_file)
iconset = gtk.IconSet(pb)
pb2 = gtk.gdk.pixbuf_new_from_file(icon_file_2)
iconsource = gtk.IconSource()
iconsource.set_pixbuf(pb2)
iconsource.set_size(gtk.ICON_SIZE_DND)
iconset.add_source(iconsource)
iconfactory.add(icon_name, iconset)
With this code, I get the image from icon_file_2 at all sizes. I expect to
see that image only during a drag (because of the set_size call). Any idea
what I am doing wrong?
--
Jeffrey Barish
More information about the pygtk
mailing list