perltux has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Tk; my $var=0; my $incr=1; my $mw=MainWindow->new(); my $scale=$mw->Scale( -variable => \$var, -to => -63, -from => 63, -resolution => $incr, -tickinterval => 0, -label => '', -width => 10, -length => 150, -sliderlength => 20, -borderwidth => 1, -highlightthickness => 0, -showvalue => 1, -orient => 'vertical' )->pack(-padx=>50); # Linux/Unix mouse wheel binding $scale->bind('<Button-4>' => sub{$scale->set($var+$incr)}); $scale->bind('<Button-5>' => sub{$scale->set($var-$incr)}); # Windows mouse wheel binding (not working) $scale->bind('<MouseWheel>' => [ sub { $_[0]->set($var+$incr*($_[1] / +120))}, Ev('D') ] ); MainLoop;
|
|---|