use Tk; $size = 0; $w = MainWindow->new(); $b1 = $w->Button(-text => 'Press me', -command => sub { doit() }); $b1->pack(-ipadx => 10, -ipady => 20); $b2 = $w->Button(-text => 'Quit', -command => sub { exit() }); $b2->pack(); MainLoop(); sub doit { $size += 10; $b2->pack(-padx => $size, -pady => $size); }