#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->geometry("600x440+100+100"); my $canvas = $mw->Canvas(-width => 600, -height => 400, -bg => 'black')->pack(); my $line; $line = $canvas->createLine(0,200,100,200,400,200,600,200, -width => 5, -smooth => 1, -splinesteps => 20, -fill => 'purple'); my $timer = $canvas->repeat(10,sub{ $canvas->delete($line); my @vals = ( 0, 200, 200, 200 + rand 300, 400, 200 - rand 300, 600, 200); $line = $canvas->createLine( @vals, -width => 5, -smooth => 1, -splinesteps => 20, -fill => 'purple'); }); $mw->Button(-text=>'Quit',-command =>sub{exit})->pack; MainLoop;