Gnome Canvas
- From: Daniel Carrera <dcarrera math toronto edu>
- To: <gtk-perl-list gnome org>
- Subject: Gnome Canvas
- Date: Sat, 12 Jan 2002 19:40:57 -0500 (EST)
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]