hi all,

there is a strange issue using

icon_theme_get_default()

for ex:

icon_theme = gtk.icon_theme_get_default()

this will show the correct icon but without any colors,

icon_theme=gtk.IconTheme()

this will use the default icon, but not the one from the theme in use,
anyway the image has the correct colors.

please try out the following script, you should understand better what i mean.

if you see any solution for this issue please let me know.

thanks

ciao

df



-------------------------
import pygtk
pygtk.require('2.0')
import gtk
import os

class Dicon:
    def __init__(self,name):
        self.win=gtk.Window()
        #icon=self.get_icon_path(name)
        #if icon==None:
        #    icon=self.get_icon_path(gtk.STOCK_MISSING_IMAGE)
        #print icon
        #icon="/usr/share/icons/Tango/scalable/devices/gtk-cdrom.svg"
        #pixbuf = gtk.gdk.pixbuf_new_from_file(icon)
        icon_theme = gtk.icon_theme_get_default()
        #icon_theme=gtk.IconTheme()
        pixbuf=icon_theme.load_icon(name,48 ,gtk.ICON_LOOKUP_FORCE_SVG)
        pixmap, mask = pixbuf.render_pixmap_and_mask()
        width, height = pixmap.get_size()
        self.win.set_app_paintable(True)
        self.win.resize(width, height+15)
        self.win.realize()
        self.win.shape_combine_mask(mask, 0, 0)
        #self.win.window.set_back_pixmap(pixmap, False)
        self.win.queue_draw()

    def get_icon_path(self, iconname):
        icontheme = gtk.icon_theme_get_default()
        if icontheme.has_icon(iconname) == True:
            icon_lookup=icontheme.lookup_icon(iconname,48
,gtk.ICON_LOOKUP_FORCE_SVG)
            icon=icon_lookup.get_filename()
            return icon
dicon=Dicon("gtk-cdrom")
dicon.win.show()
gtk.main()
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to