use strict;
use warnings;
use Tk;
use Tk::ProgressBar;

my @colors = (
       0, '#ff002a',  2, '#ff000a',  4, '#ff1000',
	     6, '#ff3000',  8, '#ff4600', 10, '#ff6100', 
	    12, '#ff8100', 14, '#ff9700', 16, '#ffbc00',
	    18, '#ffd200', 20, '#ffe700', 22, '#f0ff00',
	    24, '#dbff00', 26, '#baff00', 28, '#9fff00',
	    30, '#8aff00', 32, '#6aff00', 34, '#54ff00',
	    36, '#2eff00', 38, '#19ff00', 40, '#03ff00',
	    42, '#00ff21', 44, '#00ff37', 46, '#00ff57',
	    48, '#00ff72', 50, '#00ff87', 52, '#00ffa8',
	    54, '#00ffc3', 56, '#00ffe3', 58, '#00fff8',
	    60, '#00eaff', 62, '#00c9ff', 64, '#00b4ff',
	    66, '#008eff', 68, '#0079ff', 70, '#0063ff',
	    72, '#003eff', 74, '#0028ff', 76, '#0008ff',
	    78, '#1200ff', 80, '#2800ff', 82, '#4800ff',
	    84, '#5d00ff', 86, '#8300ff', 88, '#9900ff',
	    90, '#ae00ff', 92, '#d400ff', 94, '#e900ff',
	    96, '#ff00f3', 98, '#ff00d9' );

my $mw = MainWindow->new();
$mw->geometry( '400x120' );
$mw->resizable( 1, 0 );

my $bar = $mw->ProgressBar( -borderwidth => 2,
                            -blocks => 100,
                            -gap => 0,
		                       -troughcolor =>'white',
		                       -colors => \@colors,
		                       -length => 150 )
			          ->pack( -padx => 5, -pady => 5, -fill => 'x' );

my $slide = $mw->Scale( -orient => 'horizontal',
                        -length =>150,
		                    -showvalue => 0,
		                    -tickinterval => 20 )->pack;

$mw->Button( -text => '   Quit   ',
             -command => sub{ exit } )
     ->pack( -padx => 10, -pady => 10, -anchor=>'se' );

$slide->configure( -command => sub { $bar->value($slide->get()); } );

MainLoop;