Anoop Nagesh
2015-07-21 09:51:59 UTC
Hi,
while running my perl tk script I got an error like "Bad Screen Distance", please someone helpme regarding this issue. Thanks in advance. Here is a code for reference.
use Tk;
my $mw = new MainWindow(-title => 'TEST');
$mw->geometry("500x500");
my $canvas = $mw1->Canvas(
-width => 350,
-height => 350,
-background=>'white')
->pack();
my @arr1 = (10,100,200,150,250);
my $len = @arr1;
$ver = $canvas->createLine(5,5,5,250,
-width=>4,
-arrow=>'first',
-arrowshape=>[5,5,5]);
$hor = $canvas->createLine(3,250,250,250,
-width=>4,
-arrow=>'last',
-arrowshape=>[5,5,5]);
for (my $lp = 1,my $y=20,my $n=1,my $x=0; $lp <= $len ; $lp++,$y+=10,$n++,$x++ ){
$id = $canvas->createLine($arr1[$x],$y,$arr1[$x+2],$y,
-width=>1,
-arrow=>'both',
-arrowshape=>[3,3,3]);
$tx = $canvas->createText(int(($arr1[$x]+$arr1[$x+2])/2),$y,-text=>"$n");
}
$bt = $mw1->Button(
-text=>'Quit',
-command=>sub {exit})
->pack(
-side=>'bottom');
MainLoop;
while running my perl tk script I got an error like "Bad Screen Distance", please someone helpme regarding this issue. Thanks in advance. Here is a code for reference.
use Tk;
my $mw = new MainWindow(-title => 'TEST');
$mw->geometry("500x500");
my $canvas = $mw1->Canvas(
-width => 350,
-height => 350,
-background=>'white')
->pack();
my @arr1 = (10,100,200,150,250);
my $len = @arr1;
$ver = $canvas->createLine(5,5,5,250,
-width=>4,
-arrow=>'first',
-arrowshape=>[5,5,5]);
$hor = $canvas->createLine(3,250,250,250,
-width=>4,
-arrow=>'last',
-arrowshape=>[5,5,5]);
for (my $lp = 1,my $y=20,my $n=1,my $x=0; $lp <= $len ; $lp++,$y+=10,$n++,$x++ ){
$id = $canvas->createLine($arr1[$x],$y,$arr1[$x+2],$y,
-width=>1,
-arrow=>'both',
-arrowshape=>[3,3,3]);
$tx = $canvas->createText(int(($arr1[$x]+$arr1[$x+2])/2),$y,-text=>"$n");
}
$bt = $mw1->Button(
-text=>'Quit',
-command=>sub {exit})
->pack(
-side=>'bottom');
MainLoop;