如何获取图标名称的完整文件路径?

时间:2011-05-22 19:33:39

标签: python gtk icons gnome

如何从GNOME中的图标名称获取完整文件路径?

2 个答案:

答案 0 :(得分:12)

import gtk
icon_theme = gtk.icon_theme_get_default()
icon_info = icon_theme.lookup_icon("my-icon-name", 48, 0)
print icon_info.get_filename()

答案 1 :(得分:8)

Python 3的翻译:

from gi.repository import Gtk
icon_theme = Gtk.IconTheme.get_default()
icon_info = icon_theme.lookup_icon("my-icon-name", 48, 0)
print(icon_info.get_filename())