use warnings;
use Tk;
use strict;

# Das mw erzeugen
my $mw = MainWindow->new();

$mw->Label(-text => '    Wo ist die Maus?    ')->pack();

my $message = '? ?';

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

my $c = $mw->Canvas->pack(-fill   => 'both',
                          -expand => 1);

$c->Tk::bind('<Motion>',[\&print_coords,Ev('x'),Ev('y')]);

MainLoop;

sub print_coords
  {
  shift;
  $message = 'X: ' . $_[0] . '  Y: ' . $_[1];
  }