$acnv->rotate(TagOrID, angle ?,x, y?)
This method rotates the object identified by TagOrID by angle. The angle is specified in degrees. If an x, y coordinate is specified, then the object is rotated about that point. Otherwise, the object is rotated about its center point, if that can be determined.
####
As it stands, the module can only rotate the following object types about their centers:
Lines
Polygons
Rectangles (if rectToPoly(1) is called)
Ovals (if ovalToPoly(1) is called)
All other object types (bitmap, image, arc, text, && window) can only be rotated about another point. A warning is issued if the user tries to rotate one of these object types about their center. Hopefully, more types will be able to center-rotate in the future.
####
use Tk;
use Tk::AbstractCanvas;
my $mw=MainWindow->new(-title=>'RotateText-Test');
my $w = $mw->screenwidth;
my $h = $mw->screenheight;
$mw->geometry( $w."x".$h);
$mw->resizable(1,1);
my $canvas = $mw->Scrolled('AbstractCanvas',
-background => "white",
-scrollbars => "osoe",
-height => 0,
-relief => "solid",
-width => 0,
-scrollregion=>[0,0,1,1],
)->pack(-anchor=>'nw', -side=>'top', -fill=>'both', -expand=>1);
my $text = $canvas->createText(0,0,-anchor=>'center',-fill => 'red',-text => 'Hello Monks !!!',);
#my $text = $canvas->createText(2,10,-anchor=>'center',-fill => 'red',width => 1,-text => 'Hello Monks !!!',); ## this rotates but not the characters :(
$canvas->rotate($text,90,$x,$y);
$canvas->viewAll();
MainLoop;
();