1#!/usr/local/bin/perl -w 2use strict; 3use Tk; 4 5my $mw = MainWindow->new; 6 7my $bits = pack("b8"x5, 8 "........", 9 "...11...", 10 "..1111..", 11 ".111111.", 12 "........"); 13 14$mw->DefineBitmap('increment' => 8,5, $bits); 15# And of course, decrement is the reverse of increment :-) 16$mw->DefineBitmap('decrement' => 8,5, scalar reverse $bits); 17 18my $value = 1000; 19 20my $up = $mw->Button(-bitmap => 'increment', -pady => 0, -command => sub { $value++ } ); 21my $dn = $mw->Button(-bitmap => 'decrement', -pady => 0, -command => sub { $value-- } ); 22my $en = $mw->Entry(-textvariable => \$value, -justify => 'right', -width => 6); 23my $qu = $mw->Button(-text => 'Quit', -command => [destroy => $mw]); 24 25Tk::grid($en,$up); 26Tk::grid('^',$dn); 27Tk::grid($qu,'-'); 28 29MainLoop; 30 31 32