TooNewbie has asked for the wisdom of the Perl Monks concerning the following question:
I'm guessing I either have to define a -pagex, -pagey and then anchor on "center" or set the -x and -y. The problem is how do I determine what these values are? I've used $canvas->bbox("all") to capture the dimensions of my canvas. This allowed me to set my width and height but I could not set -x,-y or the -pagex,-pagey as the dimension values are are off by some factor. below is a snip of what I have tried but it jsut makes things worse:my @dim = $canvas->bbox("all"); my $width = ($dim[2]-$dim[0]); my $height = ($dim[3]-$dim[1]); my $ps = $canvas-> postscript( '-pagewidth' => "8 i", '-pageanchor' => "center", '-width' => $width, '-height' =>$height );
Does anyone know how tho convert the dim values so that I can use them in the -x,-y or -pagex,-pagey? Thanks in advance.my @dim = $canvas->bbox("all"); my $width = ($dim[2]-$dim[0]); my $height = ($dim[3]-$dim[1]); my $pagex = ($dim[0]+$dim[2])/2; my $pagey = ($dim[1]+$dim[3])/2; my $ps = $canvas-> postscript( '-pagewidth' => "8 i", '-pageanchor' => "center", '-pagex' => $pagex, '-pagey' => $pagey, # '-x' => $dim[0], # '-y' => $dim[1], '-width' => $width, '-height' =>$height );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dumping Tk canvas to postscript
by tachyon (Chancellor) on Mar 12, 2004 at 23:53 UTC | |
by TooNewbie (Acolyte) on Mar 15, 2004 at 14:25 UTC | |
by eserte (Deacon) on Mar 16, 2004 at 12:49 UTC | |
by TooNewbie (Acolyte) on Mar 16, 2004 at 16:56 UTC | |
by eserte (Deacon) on Mar 16, 2004 at 18:24 UTC |