Leser: 1
3 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/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( '<Motion>' => [\&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"; } }
1 2 3 4 5
if( $item and @$item ){ $canvas->configure(-cursor => 'crosshair'); } else { $canvas->configure(-cursor => 'arrow'); }
3 Einträge, 1 Seite |