Scott K Purcell schrieb:

Hello,
I am trying to learn some TK on the side here, and have a canvas error I
can't figure out.
This comes straight out of the "Advanced Perl Programming" book. page 231
and 232.

Since 231 is very simple, I will include it here and page 232 below in case
someone wants to try and run these.

The error on both of these when run from a command line is:
bad screen distance "fill" at c:/Perl/site/lib/Tk.pm line 217.

Anyway, this is just homework for me, and not holding up any jobs or hot
things at the office. But I would like to figure out why the error.
# canvas1.pl
#! perl
use Tk;
$top = MainWindow->new();
$canvas = $top->Canvas(width=>200, height=>100)->pack(); # this much runs
$id = $canvas->create('line',
                      10, 10, 100, 100,
                      fill=>'red');

put a dash before  the word "fill" like "-fill"
 
MainLoop();

# canvas2.pl
#! perl

use Tk;

$top = MainWindow->new();
$canvas = $top->Canvas(width=>300, height=> 245)->pack();
# draw a set of circles along an archimedean spiral
# the centers of these circles move along the spiral
# (radius of spiral = constant * theta)

$origin_x = 110; $origin_y = 70;
$PI = 3.1415926535;
$circle_radius = 5;
$path_radius = 0;

for ($angle = 0; $angle <=180;
     $path_radius += 7, $circle_radius +=3, $angle += 10) {
    $path_x = $origin_x + $path_radius * cos($angle * $PI / 90);
    $path_y = $origin_y - $path_radius * sin ($angle * $PI / 90);
$canvas->create('oval',
                $path_x - $circle_radius,
                $path_y - $circle_radius,
                $path_x + $circle_radius,
                $path_y + $circle_radius,
                fill=>'yellow');

put a dash before  the word "fill" like "-fill"
 
    $canvas->create('line', $origin_x, $origin_y, $path_x, $path_y, fill=>
change word "line" to "oval"
 
'slategray');
}
MainLoop();

---
You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to
         [EMAIL PROTECTED]

Now the scripts are working !

--
Mit freundlichen Grüßen
Kai Zdarsky

___________________________________________________________________

Kai Zdarsky                   grit - graphische Informationstechnik
[EMAIL PROTECTED]               Beratungsgesellschaft mbH
Buero Werne
                              Buero Werne:
                              Landwehrstr. 143
                              D-59368 Werne
                              +49-2389-9827-36
                              +49-2389-9827-27 fax
 

Reply via email to