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); }