根据 GIO 文档,可以通过 g_file_info_get_icon () http://developer.gnome.org/gio/stable/GFileInfo.html#g-file-info-get-icon 获取文件的图标
但这不起作用,看看这个样本:
print(somefile) # <FileInfo object at 0x17bf820 (GFileInfo at 0x1b15d00)>
icon = somefile.get_icon()
print(icon) # always None
if icon is Gio.Icon:
print("isicon") # never happens
我已经用我的整个主文件夹对其进行了测试,get_icon() 总是返回无。我是否犯了任何错误,或者这个函数根本不能与 python / pygobject 一起使用?