Re: a couple of Gnome2::Canvas problems

On Wed, 13 Jul 2005 08:33:21 -0400 (EDT)

Date: Wed, 13 Jul 2005 17:47:38 +1200
From: Grant McLean <grant mclean net nz>
Subject: Re: a couple of Gnome2::Canvas problems
To: "gtk-perl-list gnome org" <gtk-perl-list gnome org>

I tried your script and got the same errors.  It piqued my interest
because the error seem to occur even when all calls to update meter are
removed.  If I put a die in the update_meter routine, it was never
reached and yet commenting out the $needle->set and $text->set made the
errors go away.  Very odd.

I was testing on Debian Sarge and a colleague tested on Debian unstable.
He did not get the errors.  I'm assuming that the libraries are
different versions.

Anyway, I was able to make the errors go away by making these 3 changes:

-$window->signal_connect( 'destroy' => \&delete_event );
+$window->signal_connect( 'delete-event' => \&delete_event );


sub delete_event {
-    $canvas->destroy;
-    return 0;
+    return 1;

That didn't work for me.

Was there any particular need to destroy the canvas object rather than
leaving it to be cleaned up?

Well it was just the steps I took in the programming. The first version, had no
text display, and I got the error. The error went away with
adding $canvas->destroy;

Then I added the text, and the error appeared again, but it would not
go away, as long as the text was being updated. I tried to put
$text->destroy but that didn't work. But as muppet pointed out
undef $text  ( and all the canvas items)  does the trick.

I've attached a tweaked version of the script that uses a Bezier curve
to create a half circle rather than using an ellipse object.


Great....I was looking for an example to make a Bezier, but I guess we are
the ones making examples for others. :-) Thanks.  By the way, I did
figure out clipping the circle, by just putting the $canvas into a vbox.


I'm not really a human, but I play one on earth.

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