in reply to Center a Tk window under mouse cursor

The position of a new window, is usually controlled by an option in your WindowManager. Look thru your WindowManager options for things like "new window at pointer", or similar things. Usually they either center new windows, or try to put it in an empty space.

About the only thing you can do is drag the window after creation.

#!/usr/bin/perl use Tk; my $mw = tkinit; $mw->geometry('200x200+200+200'); #$mw->overrideredirect(1); $mw->bind('<ButtonPress-1>', sub{ my $xe = $mw->XEvent; $wdragiinfo{xoff} = $mw->pointerx - $mw->rootx; $wdragiinfo{yoff} = $mw->pointery - $mw->rooty; }); $mw->bind('<B1-Motion>', sub{ my ($x,$y); $x=$mw->pointerx-$wdragiinfo{xoff}; $y=$mw->pointery-$wdragiinfo{yoff}; $mw->geometry($mw->width."x".$mw->height."+$x+$y"); }); MainLoop;

I'm not really a human, but I play one on earth Remember How Lucky You Are