#!/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"; }