Perl and Gtk2 與中文

趁著還記得趕快記下來^^
Perl的encode轉換做的很不錯喔~~~
Gtk2是吃utf8的,透過轉換可以很方便的使用中文

這是我寫的範例…

#!/usr/bin/perl -w
#a71d5d;">use strict;
#a71d5d;">use Gtk2;
#a71d5d;">use encoding "Big5",#0086b3;">STDOUT=>"utf8";

Gtk2->init;
#a71d5d;">my $title #a71d5d;">= "Hello 2 !";
#a71d5d;">my $win #a71d5d;">= Gtk2::Window->new ("toplevel");
$win->set_title ($title);
$win->set_default_size (#0086b3;">200,#0086b3;">200);
$win->signal_connect("delete_event",#a71d5d;">sub { Gtk2->main_quit;});

#a71d5d;">my $vbox #a71d5d;">= Gtk2::VBox->new (#0086b3;">0, #0086b3;">0);
$win->add ($vbox);

#a71d5d;">my $str #a71d5d;">= <<#63a35c;">HERE;

測試	測試
哈哈
Perl is very good ^^

#63a35c;">HERE
#a71d5d;">my $label #a71d5d;">= Gtk2::Label->new ($str);
$vbox->pack_start ($label,#0086b3;">1 ,#0086b3;">1 ,#0086b3;">0);

$win->show_all;
Gtk2->main;

已發佈

分類:

,

作者:

標籤: