Add scroll listener to a Scale : Scale « GUI « Perl






Add scroll listener to a Scale

   

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;

   
    
    
  








Related examples in the same category

1.Bind variable to a Scale
2.Set from value, to value, tickinterval, length
3.Using Scale control