#!/usr/bin/perl use Tk; $m=Tk::MainWindow->new(); # create a button with a callback to do_warp $b=$m->Button(-text => "Press Me", -command => \&do_warp); # some filler labels so that the pointer warp is obvious $filler1=$m->Label(-text => " "); $filler2=$m->Label(-text => " "); # this label is where the mouse pointer ends up $l=$m->Label(-text => "Mouse ends up here"); $b->pack(); $filler1->pack(); $filler2->pack(); $l->pack(); MainLoop; sub do_warp { $l->eventGenerate('',-warp => 1); }