Category: InstallNote Keywords: Gtk2 Win32
参加了 Alexe 的项目 ShellWeb, 需要用到 Gtk2所以是安装模块。CPAN 的话比较麻烦,而 ppm 比较简单。
run->cmd
ppm install http://gtk2-perl.sourceforge.net/win32/ppm/ExtUtils-Depends.ppd
ppm install http://gtk2-perl.sourceforge.net/win32/ppm/ExtUtils-PkgConfig.ppd
ppn install http://gtk2-perl.sourceforge.net/win32/ppm/Gtk2-GladeXML.ppd
ppm install http://gtk2-perl.sourceforge.net/win32/ppm/Glib.ppd
ppm install http://gtk2-perl.sourceforge.net/win32/ppm/Gtk2.ppd
Updated
Alexa 说可以从 http://gladewin32.sourceforge.net 下 Win32 版本的 GTK+我试了下,果然简单了许多。
Thanks.
Abandoned
安装完模块还没完。因为我们还缺少 Gtk2 所需要的一些 dll 文件。所以得去下载:
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/atk-1.9.0.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/cairo-1.0.2.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/glib-2.8.4.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/gtk+-2.8.9.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/pango-1.10.1.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/gettext-0.14.5.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/libiconv-1.9.1.bin.woe32.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/pkg-config-0.20.zip
ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/zlib123-dll.zip
将这些下载回来的文件同时解压缩到一个文件夹。比如 E:/tools
然后在环境变量里添加 E:/tools/bin我还有缺少一个文件。从 http://www.dll-files.com/dllindex/dll-files.shtml?libpng13 下载 libpng13.dll然后试试运行下面的 pl 代码:
use Gtk2 -init;如果幸运的话应该会有个 Gtk 窗口弹出来。不幸运的话看看还缺少什么 dll 文件。
# Gtk2->init; works if you didn't use -init on use
my $window = Gtk2::Window->new ('toplevel');
my $button = Gtk2::Button->new ('Quit');
$button->signal_connect (clicked => sub { Gtk2->main_quit });
$window->add ($button);
$window->show_all;
Gtk2->main;
一般在 ftp://ftp.gtk.org/pub/gtk/v2.8/win32/ 和 ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/ 里能找到。实在找不到搜索 Google, http://www.dll-files.com/ 这个网站应该能找到。Good luck!