2

在我使用 Python 和 PyGTK 编写的可执行应用程序中,弹出 FileChooserDialog 给我这个警告:

GtkWarning: Could not find the icon 'gtk-file'.
The 'hicolor' theme was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases

该链接将我带到似乎是为 Linux 编写的存档。这个警告不会抑制我的程序的运行,但它很烦人,我认为它让我的用户感到困惑。当我从源代码运行应用程序时不会发生这种情况,只有当我首先使用 pyinstaller 将其构建为可执行文件时。有谁知道我如何找到这个图标?

4

1 回答 1

1

我解决了,但是……不合逻辑……我想。

从理论上讲,pygtk默认情况下应该嵌入完整的图标集,所以真正奇怪的是“为什么会记录这些警告?”。

解决方案(适用于我的四个项目):

  1. 在项目的根目录中,应该存在一个share文件夹(如果没有,请创建它),您必须创建这些额外的子文件夹:

    YourProjectRoot / share / icons /hicolor /

  2. 下载gnome 的官方二进制图标主题(12 MB ZIP 文件)

  3. 解压缩存档,gnome-icon-theme_2.24.0-1_win32.zip/share/icons/gnome/找到文件index.theme并将其复制到hicolor /您创建的文件夹中。

就这样

于 2014-11-08T17:46:27.843 回答