$mw->Button(-text => 'Quit', -command => sub { print 'Bye!'; exit; })->pack;
####
$mw->bind('' => \&print_something);
####
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = MainWindow->new;
$mw->geometry("700x600");
my $canvas = $mw->Canvas->pack(-fill=>'both', -expand=>'both' );
$canvas->CanvasBind("", [ \&print_xy, Ev('x'), Ev('y') ]);
MainLoop;
sub print_xy {
my ($canv, $x, $y) = @_;
print "(x,y) = ", $canv->canvasx($x), ", ", $canv->canvasy($y), "\n";
}
####
use Tk::WidgetDump;
use Tk::ObjScanner;
# and later
Tk::ObjScanner::scan_object($the_widget_or_window_to_inspect);