Re: a couple of Gnome2::Canvas problems



On Wed, 13 Jul 2005 08:30:31 -0400
muppet <scott asofyet org> wrote:


On Jul 11, 2005, at 12:58 PM, zentara wrote:

I'm trying to make a simple gauge with the Gnome2::Canvas.
It all works well, except when I destroy the meter.  I get an error

nomeCanvas-CRITICAL **: file gnome-canvas.c: line 3698  
(gnome_canvas_request_redraw): assertion `GNOME_IS_CANVAS (canvas)'  
failed during global destruction.

Simple solution -- clear your own item references just before  
destroying the canvas.


###########################################################3
sub delete_event {

    # clear our item references, so things can die in peace.
    $text = undef;
    $box = undef;
    $hub = undef;
    $gauge = undef;
    $floor = undef;
    $needle = undef;

    $watch->Unwatch;
    $canvas->destroy;
    Gtk2->main_quit;
    return 0;
}

Thanks, I did try $text->destroy,etc, but no luck. I should have thought of
undef.

By the way, I also found the way to clip the bottom of the gauge circle,
.......just put the canvas into a vbox......doh!!!.

my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);

my $canvas = Gnome2::Canvas->new_aa();
$canvas->set_size_request($width,$height);
$canvas->set_scroll_region( 0, 0, $width, $height );   #to get upper left corner 
$canvas->set_size_request( $width, $height ); #useless ? 

$vbox->pack_start($canvas,FALSE,FALSE,0);
$window->show_all;


Thanks again.


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



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