Just a little Tk script to demonstrate the "persistence-of-image" problem in eyes. It's safer than looking at the sun. :-) Just stare at the cross-hairs, you should see a pink orb, where there is none.

UPDATE: I fixed a logic error which caused it to skip at 7 o'clock.

#!/usr/bin/perl use warnings; use strict; use Tk; # stare at the cross-hairs, a pink orb # should appear rotating, where there is none my $mw = MainWindow->new(); # first create a canvas widget my $canvas = $mw->Canvas(width => 600, height => 600, -bg => 'gray', )->pack(); my %pos; my $angle = 0; my $radius = 200; my $pos; my $hidden = 0; foreach my $pos(0..11){ my $x = 300 + sin($angle)*$radius; my $y = 300 + cos($angle)*$radius; my $x1 = $x - 40; my $y1= $y - 40; $pos{$pos} = $canvas->createOval($x,$y,$x1,$y1, -fill => 'green', -outline=>'green', -tags => [$pos], # -stipple => 'gray75', ); $angle += .5236; # (pi / 180) * 30 } $canvas->createLine(260,280,300,280, -width=>5, -fill=>'black'); $canvas->createLine(280,260,,280,300, -width=>5, -fill=>'black'); my $ebutton = $mw->Button(-text => 'Exit', -command => 'Tk::exit')->pack(); $pos = 0; my $timer = $mw->repeat(100,sub{ $canvas->itemconfigure($pos{$hidden} , -state => 'normal'); $canvas->itemconfigure($pos{$pos}, -state => 'hidden'); $hidden = $pos; $pos++; if($pos == 12){ $pos=0 }; }); MainLoop();

In reply to Tk Optical Illusion by zentara

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.