#!/usr/bin/perl -w use strict; use Tk; my $w = MainWindow->new; my $button; $button = $w->Button(-text => "click me", -command => sub { my $mw = $w->Toplevel; # here I need somehow position the $mw over the $button $mw->Label(-text => "hello")->pack(); })->pack; MainLoop; #### my @wg = ($w->geometry =~ /\+(\d+)\+(\d+)/); my @bg = ($button->geometry =~ /\+(\d+)\+(\d+)/); $wg[$_] += $bg[$_] for (0..@wg-1); $mw->geometry("+$wg[0]+$wg[1]");