use warnings; use strict; use Tk; my $mw = tkinit(); my $button = $mw->Button(-text => 'Button')->pack(); $button->bind('', \&buttonPress); $mw->MainLoop(); sub buttonPress{ print 'RootX:' . $button->rootx . "\n"; print 'RootY:' . $button->rooty . "\n"; print 'Width:' . $button->cget(-width) . "\n"; print 'Height:' . $button->cget(-height) . "\n"; }