How can I create an arc (-style=>'chord') with an arrow on the end, in a Perl-Tk canvas?
This sounded like a simple thing for me to answer. It's turning into a quagmire. Here's where I've been so far:
Any thoughts are much appreciated.
Thanks
-Craig
use strict; use warnings; use Tk; my $top = MainWindow->new; my $can = $top->Canvas()->pack(); my @offset = (100, 100); my $PI = atan2(1,1) * 4; my $max = 100; my $radius = 20; my @coords; foreach my $i (1..$max-30) { push(@coords, _circleCoord($i*2*$PI/$max, $radius)); } $can->createLine(@coords, -arrow=>'last', #-arrowshape=>[10, 15, 9], # Goofy arrowhead - this helps tags=>['SELFARROW']); $can->move('SELFARROW', @offset); MainLoop; sub _circleCoord { my $radians = shift || die "Missing radians"; my $radius = shift || die "Missing radius"; my @coords; push(@coords, ($radius * sin($radians))); push(@coords, ($radius * cos($radians))); return(@coords); }
In reply to Tk:Canvas - Arc with an arrow? by cmv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |