The easiest way would be the Tk Canvas. See
Tk compass dial for a simple demo. Once you create your Canvas plot, you can print it to postscript, like this:
#!/usr/bin/perl
use Tk;
#to change the background color, edit the ps file
# 0.000 0.000 0.000 setrgbcolor AdjustColor
# fill
$width = 800;
$height = 500;
my $main = MainWindow->new();
my $canvas = $main->Canvas( -width=>$width, -height=>$height, -backgro
+und=>"black");
$canvas->pack( -expand=>1,-fill=>'both');
&create;
$canvas->update;
$main->update;
$main->Button(
-text => "Save",
-command => [sub {
$canvas->update;
my @capture=();
my ($x0,$y0,$x1,$y1)=$canvas->bbox('all');
@capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x
+0);
$canvas -> postscript(-colormode=>'color',
-file=>$0.'.ps',
-rotate=>0,
-width=>800,
-height=>500,
@capture);
}
] )->pack;
MainLoop;
sub create{
$canvas->createOval(100, 100, 600, 600,-fill=>'green')
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.