use Tk; $top = new MainWindow; $p = $top->Photo(-width => 400, -height => 300); $c = $top->Canvas(-width => 400, -height => 300)->pack(-fill => "both", -expand => 1); $img = $c->createImage(0,0,-image=>$p,-anchor=>"nw"); for my $x (-$p->width/2 .. $p->width/2) { my($tx) = int($x+$p->width/2); my $y = sin($x/10)*$p->height/2; my($ty) = int($y+$p->height/2); $p->put("#ff0000", -to => $tx,$ty+1,$tx+1,$ty); } MainLoop;