When I run your review2.pm, I get your error. But I added a line which shows the problem. I can't figure out why it allowed you to create an Oval to begin with.?
sub paint_Info{
#this shows the problem
my ($MW, $CW, $zoom) = @_;
print "\n\n@_\n\n";
$CW->createOval( 30, 30,
15, 15,
-outline => 'red', -width => 2,
-tags => ['INFO']);
my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom;
$CW->scale('all', 0, 0, $zfactor, $zfactor);
}
When you print out @_, you get
MainWindow=HASH(0x7b8078) Tk::Frame=HASH(0xe2bfb0) 1
You then take $_
1 and try to run Canvas methods on it. Scale will not run on a Frame, that is a Canvas method.
It just dawned on me! Your Frame is the Scrolled Frame the Canvas is in. Try
getting the real canvas in your module. This fixes it! :-)
sub paint_Info # ($MW, $Config)
{
my ($MW, $CW, $zoom) = @_;
print "\n\n@_\n\n";
my $canvas = $CW->Subwidget('canvas');
$canvas->createOval( 30, 30,
15, 15,
-outline => 'red', -width => 2,
-tags => ['INFO']);
my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom;
$canvas->scale('all', 0, 0, $zfactor, $zfactor);
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.