Add Scroll Listener To A Scale in Perl

This article demonstrates the implementation of Add scroll listener to a Scale



Implementation

use Tk;

$main = MainWindow->new();

$main->Scale('-orient'=> 'horizontal', 
    '-from' => 0,
    '-to' => 200, 
    '-tickinterval' => 40,
    '-label' => 'Select a value:', 
    '-length' => 200,
    '-variable' => \$value, 
    '-command' => \&display
)->pack;

$text1 = $main->Text ('-width'=> 40, 
    '-height' => 2
)->pack;

sub display
{
    $text1->delete('1.0','end');
    $text1->insert('end', "$value");
}

MainLoop;