关于Python可执行文件中缺少GTK图标的警告

时间:2012-09-28 15:18:01

标签: python gtk pygtk pyinstaller

在我用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将其构建为可执行文件时。有谁知道我如何找到这个图标?

1 个答案:

答案 0 :(得分:1)

我解决但......不合逻辑..我想。

从理论上讲, pygtk 默认情况下应该嵌入完整的图标集,所以真正奇怪的是"为什么它会记录这些警告?"。
解决方案(适用于我的四个项目):

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

    YourProjectRoot / share / icons / hicolor /

  2. 下载official binary icon theme for gnome(12 MB ZIP文件)

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

  4. 全部