Re: Widget in Gnome2 Canvas not visible



Do you ->show() the button?

Yes. Here is a small sample. The rectangle is visible, but the button is
not. Also, the window starts up tiny. It would be nice to have the
initial size be larger.

#!/usr/bin/perl -w

use Gnome2::Canvas;
use Gtk2 '-init';

$win = Gtk2::Window->new;
$frame = Gtk2::Frame->new;
$canvas = Gnome2::Canvas->new;
$frame->add($canvas);
$win->add($frame);

$root = $canvas->root;
$frame->show();

$button = Gtk2::Button->new("Some Text");
$button->show();

$item = Gnome2::Canvas::Item->new($root,
                                  "Gnome2::Canvas::Widget",
                                  widget => $button,
                                  x => 2,
                                  y => 2,
                                  );
$item2 = Gnome2::Canvas::Item->new($root,
                                   "Gnome2::Canvas::Rect",
                                   x1 => 100,
                                   y1 => 100,
                                   x2 => 190,
                                   y2 => 150,
                                  fill_color => "white",
                                  outline_color => 'black',
                                  );
$win->show_all();
Gtk2->main;


-- 
=============================================================================
Mike Mayer                                      Phone: (608) 523-1960
Circuitfarm, Inc.                               Cell:  (608) 575-2732
mikem circuitfarm com





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