#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = tkinit; my $canvas = $mw->Canvas->pack; $canvas->createLine(10,200,159,300); $canvas->Tk::bind( '' => [\&select_cursor, Ev('x'), Ev('y')] ); MainLoop; sub select_cursor{ my ($c,$x,$y) = @_; my @coords = ($x-5, $y-5, $x+5, $y+5 ); my $item = $c->find('overlapping', @coords); if( $item and @$item ){ print "wechsel den Cursor"; } }