in reply to How do I move a top level window in Tk?

I figured it out. In my call to create the DialogBox I put this:
-showcommand => sub { my($dlg) = @_; $dlg->geometry('900x600+400+250' +); }
Just calling geometry() on creation was fine for the first time the dialog was posted, but if I close and then reopen the dialog, the coordinates revert to the bad location.

This approach to setting coordinates is about the most obscure one I have ever seen. - Paul

Replies are listed 'Best First'.
Re^2: How do I move a top level window in Tk?
by Anonymous Monk on May 13, 2009 at 03:52 UTC
    reopen a dialog?
    #!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit; $mw->Button( -text => "Button", -command => sub { my $d = $mw->Dialog( -title => "Title", -buttons => [ "OK", "Cance +l" ] ); $d->geometry('200x200+40+40'); warn 'Show ', $d->Show; $d->destroy; undef $d; }, )->pack; $mw->MainLoop; __END__
      Your suggestion is a good one. I have recently been programming in Flash ActionScript and the paradigm is to create a dialog in one place, then open it when needed, close it without disposing, and reopen on subsequent use. When you reopen a dialog, the state is the same as when the user last had it open, which is useful for some dialogs - hence the approach. But in my case, I could have disposed it after all. - Paul