#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Axis; # from Tk-Contrib-0.07 my $mw = MainWindow->new(); $mw->geometry("600x600+10+10"); #the axis widget is a canvas #the origin is in the upper left corner, #so the (0,0) point corresponds to (25,575) #in this example (600 - margin) my $axis = $mw->Axis( -background => 'white', -height => 600, -width => 600, -margin => 25, -tick => 10, #-tickfont => $tickfont, #-tst => $tst, #-width => $width, -xmin => 0, -xmax => 100, -ymin => 0, -ymax => 100, )->pack(); $axis->Tk::bind("", [ \&print_xy, Ev('x'), Ev('y') ]); MainLoop; sub print_xy { print "@_\n"; my ($canv, $x, $y) = @_; print "(x,y) = ", $canv->canvasx($x), ", ", $canv->canvasy($y), "\n"; }