#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = tkinit(); $mw->geometry('200x200'); $mw->update; for my $x ( 1 .. 50 ) { my $y = sin($x)*100; my $x1 = 100; my $x2 = $x1 + $y; ($x1, $x2) = ($x2, $x1) if $x2 < $x1; $mw -> draw_hl( $x1, $x*4, $x2-$x1, 'darkblue', ); $mw -> update; } # for MainLoop; # # draw an horizontal line using a Frame widget # sub Tk::Toplevel::draw_hl { my( $mw, $x, $y, $w, $c ) = @_; $mw -> Frame( -width => $w, -height => 1, -bd => 0, -background => $c, ) -> place( -x => $x, -y => $y, ); } # draw_hl __END__