Frage

I am attempting to get a window's icon name with python, for use in a pyclutter-based taskbar. I have gotten the XID via wnck, but wnck seems to only be capable of giving me a gtk.gdk.Pixbuf, which is not useful for clutter. I am sure there is some way to do this with python-xlib or python-xcb, I just can't find it :-)

Any ideas?

War es hilfreich?

Lösung

you can use a gdk.Pixbuf to get the icon data and assign it to a clutter.Texture - the C version is:


clutter_texture_set_from_rgb_data (texture,
                                   gdk_pixbuf_get_pixels (pixbuf),
                                   gdk_pixbuf_get_has_alpha (pixbuf),
                                   gdk_pixbuf_get_width (pixbuf),
                                   gdk_pixbuf_get_height (pixbuf),
                                   gdk_pixbuf_get_rowstride (pixbuf),
                                   gdk_pixbuf_get_has_alpha (pixbuf) ? 4 : 3,
                                   CLUTTER_TEXTURE_NONE,
                                   &error);

but I'm pretty sure you can achieve the same in Python as well.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top