叶文彬 > Goo-Canvas-0.06 > Goo::Canvas

Download:
Goo-Canvas-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  0
View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Goo::Canvas - Perl interface to the GooCanvas

SYNOPSIS ^

    use Goo::Canvas;
    use Gtk2 '-init';
    use Glib qw(TRUE FALSE);

    my $window = Gtk2::Window->new('toplevel');
    $window->signal_connect('delete_event' => sub { Gtk2->main_quit; });
    $window->set_default_size(640, 600);

    my $swin = Gtk2::ScrolledWindow->new;
    $swin->set_shadow_type('in');
    $window->add($swin);

    my $canvas = Goo::Canvas->new();
    $canvas->set_size_request(600, 450);
    $canvas->set_bounds(0, 0, 1000, 1000);
    $swin->add($canvas);

    my $root = $canvas->get_root_item();
    my $rect = Goo::Canvas::Rect->new(
        $root, 100, 100, 400, 400,
        'line-width' => 10,
        'radius-x' => 20,
        'radius-y' => 10,
        'stroke-color' => 'yellow',
        'fill-color' => 'red'
    );
    $rect->signal_connect('button-press-event',
                          \&on_rect_button_press);

    my $text = Goo::Canvas::Text->new(
        $root, "Hello World", 300, 300, -1, 'center',
        'font' => 'Sans 24',
    );
    $text->rotate(45, 300, 300);
    $window->show_all();
    Gtk2->main;

    sub on_rect_button_press {
        print "Rect item pressed!\n";
        return TRUE;
    }

DESCRIPTION ^

GTK+ does't has an buildin canvas widget. GooCanvas is wonderful. It is easy to use and has powerful and extensible way to create items in canvas. Just try it.

For more documents, please read GooCanvas Manual and the demo programs provided in the source distribution in both perl-Goo::Canvas and GooCanvas.

SEE ALSO ^

Gtk2(3pm)

AUTHOR ^

Ye Wenbin <wenbinye@gmail.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2007 by ywb

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: