1

I got icon data into a Python list. How could I get this icon data into pixbuf? I could not find it in this source.

Here is the code I get icon data:

from gi.repository import Gio

apps = Gio.AppInfo.get_all()
icon = apps[0].get_icon()
print(icon)

Python 3, GTK3, OS: Debian-like Linux.

demirod
  • 81
  • 15

2 Answers2

1

I could not find how to get Gio.AppInfo icons into pixbuf, but I solved my problem in another way.

I have found Desktop application files in the /usr/share/applications/ location. I could get specific application icon by reading .desktop file of it. Fİnally I could get the icon into pixbuf by using new_from_file() command.

demirod
  • 81
  • 15
0

The code that works in my machine is:

#!/usr/bin/python3

from gi.repository import Gio

apps = Gio.AppInfo.get_all()
icon = apps[0].get_icon().to_string()
print (icon)

The following also works:

#!/usr/bin/python3

from gi.repository import Gio

apps = Gio.AppInfo.get_all()
icon = apps[0].get_icon()
print (Gio.ThemedIcon.get_names(icon))
Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87