このエントリーをはてなブックマークに追加


Ubuntu12.04にwxPerlの環境をインストールしてみた

Ubuntu12.04にwxPerlの環境をインストールしてみたときの備忘録です。


スポンサーリンク

関連記事

wxPerlのインストール

以下のコマンドでwxPerl関連のパッケージを検索しインストールしました。

  • wxperlのパッケージを検索。
    $ apt-cache search wxperl
    libwx-perl - interface to wxWidgets cross-platform GUI toolkit
    上記の検索結果からlibwx-perlをインストール。
    $ sudo apt-get install libwx-perl

wxPerlでHello world

以下URLのサンプルコードを使用しwxPerlでHello worldを実行しました。
http://examples.wxperl.it/2013/03/hello-world.html

#!/usr/bin/perl
use strict;
use warnings;
use Wx;

package MyApp;
use base 'Wx::App';

sub OnInit {
    my( $self ) = @_;
    # create a new frame (a frame is a top level window)
    my $frame = Wx::Frame->new(
        undef,           # parent window
        -1,              # ID -1 means any
        'Hello World',   # title
        [-1, -1],        # default position
        [250, 150],      # size
    );
    $frame->Show( 1 );


    return 1;
}

package main;

my $app = MyApp->new;

$app->MainLoop;

実行結果

$ chmod +x wxHello.pl
$ ./wxHello.pl
01.gif

以上、Ubuntu12.04でwxPerlをインストールした時の備忘録です。


スポンサーリンク


添付ファイル: file01.gif 498件 [詳細] filewxHello.pl 423件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-03-20 (金) 22:31:20