Re: Gnome Canvas



You are actually displaying a canvas. The problem is that it has
zero size! You can manually set the size of the canvas after
creating it by doing:

    $canvas->set_usize(256,256);

That takes care of your problem.

Regards,
Dov

On Sat, Jan 12, 2002 at 07:40:57PM -0500, Daniel Carrera wrote:
Hello,
My name is Daniel Carrera and I'm a new subscriber to the list.  I've
recently started using GtkPerl.  I am having a few problems and I was
hoping that someone could help me out.

I want to make a Gnome app with a canvas, but I can't seem to be able to
have both a toolbar and a canvas.

In the program below I've used '=pod ... =cut' to comment out the toolbar.
As it is, the program draws the square fine.  If I comment out the '=pod'
and '=cut', the toolbar appears, and the canvas does not.


 1 #!/usr/bin/perl
 2 use Gnome;
 3
 4 $NAME = 'GTK: Canvas Example';
 5 init Gnome "$NAME";
 6
 7 $App = new Gnome::App $NAME, $NAME;
 8 $canvas = new Gnome::Canvas;
 9
10 =pod
11 $App->create_toolbar(
12                 {
13                       type        => 'item',
14                       label       => 'Exit',
15                       pixmap_type => 'stock',
16                       pixmap_info => 'Quit',
17                       hint        => "Click here to quit",
18                       callback    => sub { Gtk->main_quit },
19                 }
20 );
21 =cut
22 $App->set_contents($canvas);
23 $canvas->show;
24
25 $canvas->style->bg('normal', $canvas->style->white);
26 $root = $canvas->root;
27 $group = $root->new($root, "Gnome::CanvasGroup");
28 $rect = Gnome::CanvasItem->new($group, "Gnome::CanvasRect",
29         x1 => 0, x2 => 100, y1 => 0, y2 => 100,
30         outline_color => "black",
31         fill_color    => "blue",
32         width_pixels  => 2
33 );
34 show_all $App;
35 main Gtk;


I hope that someone can tell me what I'm doing wrong here.

Thanks a million,
Daniel.

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

-- 
                                                                    ___
Dov Grobgeld                        | Email: dov orbotech com      /+  \  PCB
Algorithms Group Leader, Orbotech   | Phone: +972-8-9423882        \  +/  AOI
POB 215, Yavne 81102, Israel        | Fax:   +972-8-9423775       __| |
               Disclaimer: All views above are mine alone.        ____|



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]