use warnings;
use strict;
use Tk;

# Das mw erzeugen
my $mw = MainWindow->new();
$mw->Label(-text => '     Test für Bind     ')->pack();

my $message;

$mw->Label(-textvariable => \$message, -width => 20)
      ->pack(-side => 'bottom', -fill => 'x');

foreach my $text (qw/eins zwei drei/) 
  {
  my $b = $mw->Button(-text => "Button $text",
                      -command => [$mw => 'bell'])
                 ->pack(-fill => 'x');
  $b->bind('<ButtonPress>'   => sub { $message = $text . " gedrueckt"; } );
  $b->bind('<ButtonRelease>' => sub { $message = $text . " losgelassen"; } );
}

MainLoop();
