#!/usr/local/bin/perl -w use strict; use Tk; my $mw = new Tk::MainWindow; my $c = $mw->Canvas->pack; my $tx = $c->createText(20, 10, -text => 'X: UNKNOWN'); my $ty = $c->createText(20, 25, -text => 'Y: UNKNOWN'); $c->Tk::bind('' => [sub { my ($e,$x,$y) = (@_); $c->itemconfigure($tx, -text => "X: $x"); $c->itemconfigure($ty, -text => "Y: $y"); }, Ev('x'), Ev('y')]); MainLoop;