ELISHEVA++ liverpole++

Many, many thanks for your work on this problem. It was a delight for me to read through your responses first thing this morning!

ELISHEVA, your find-the-end-of-the-arc solution works great, in combination with liverpole's fantastic try-things-out-and-play-with-it-script, and the synergy between the two of you has helped educated me in this area quite a bit. Thanks for going all PerlMonks on this one. It's exactly what I needed.

In the mean time, I continued on with the bunch-o-lines solution, after posting this and came up with the final version attached here.

My guts are telling me that the right solution is to get Tk to add an arrow option on to the end of the canvas arc item (and possibly others). I've run this gauntlet a long time ago to add a Get/Delete Enhancement for Tk Text Widget, so maybe this would be a good long-term solution (opinions?).

In any case, thanks again for all the valuable help!

-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 $start=35; my $end=$max-22; # Generate list of line segments... my @coords; foreach my $i (1..$end) { my $radians = ($i+$start)*2*$PI/$max, $radius; my @nextXY = ( $radius * sin($radians), # X-val $radius * cos($radians), # Y-val ); push(@coords, @nextXY); } # Fix things for the arrowhead... $coords[-1] -= 2; # y $coords[-2] += 2; # x # Draw the line (arrowed arc)... my $l = $can->create('line', \@coords, -arrow=>'last'); $can->move($l, @offset); MainLoop;

In reply to Re: Tk:Canvas - Arc with an arrow? by cmv
in thread Tk:Canvas - Arc with an arrow? by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.