win下安装perl-gtk

来源:互联网 发布:linux 指令ps 编辑:程序博客网 时间:2024/05/17 07:49

   今天在perl的群里听说,用perl用gtk写界面比较容易,就想尝试一下,遇到到了perl版本问题,其他都很顺利。

     先找相关模块的主页,win版的是http://gtk2-perl.sourceforge.net/win32/

     需要perl,gtk+(成套gtk),gtk2-perl(一套打通任督二脉的库),glade(编写界面的工具)

     过程如下:

    1.安装activeperl  5.8.8,之前装了一个5.14.x的后面怎么都装不了,谷歌了半天,发现默认支持5.8.9的版本。

    2.安装gtk+,编译也可以二进制安装也可以http://gladewin32.sourceforge.net/

     3.安装Glade ,不是必须的  上面地址也有下.

     4. 之后安装

ExtUtils-Depends-0.205DownloadExtUtils-PkgConfig-1.07DownloadCairo-1.021DownloadGlib-1.142DownloadGtk2-1.141DownloadGtk2-GladeXML-1.006Download

这些包下载下来

   用ppm intall packagename.ppm安装就行了.

5.测试一下

#!/usr/bin/perl -w
use strict;
use Gtk2 '-init';
my $window = Gtk2::Window->new;
my $label = Gtk2::Label->new ('Hello World!');
$window->add ($label);
$window->show_all;
Gtk2->main;

出来一个helloworld的小窗口 表示成功了。

   附上一点资料

◮ Gtk2-Perl Tutorial -
http://gkt2-perl.sf.net/doc/gtk2-perl-tut/
◮ Gtk2-Perl Study Guide -
http://forgeftp.novell.com/gtk2-perl-study/homepage/
◮ Gtk2-Perl Pod Documentation -
http://gtk2-perl.sourceforge.net/doc/pod/
◮ My Tutorial for Gtk2-Perl -
http://spr.mahonri5.net/wordpress/gtk2-perl-tutorial
This covers a few things not mentioned tonight: menubars,
toolbars, statusbars, and greater detail on ithreads.

thx 2 Scott Paul Robertson
homepage:http://scottr.org/

引自:http://hi.baidu.com/cyg07/item/d4d5b60e8451903af3eafc5f