in reply to Tk multiple monitor problem

Try setting the screen option. On my system, the default would be :0.
#!/usr/bin/perl use strict; use warnings; use 5.012; use Tk; use Tk::DialogBox; my $mw = MainWindow->new(-screen => $ARGV[0] || $ENV{'DISPLAY'}); $mw->geometry('200x200+-300+300'); $mw->DialogBox(-buttons => [ 'OK' ]) ->Show(-popover => $mw); MainLoop;

Replies are listed 'Best First'.
Re^2: Tk multiple monitor problem
by JohnRS (Scribe) on Mar 09, 2012 at 23:17 UTC

    I'm afraid that adding the parameters to "new" doesn't make any difference when I try it. The screen shows up on the left monitor, but the DialogBox shows up on the main monitor.

      Hmmm...Maybe Show needs to be handled differently. I tried this, but I used a different geometry.
      #!/usr/bin/perl use strict; use warnings; use Tk; use Tk::widgets qw/DialogBox/; require Tk::LabEntry; my $uname = 'Anonymous'; my $pw = 'Anonymous'; my $mw = MainWindow->new( -screen => $ARGV[0] || $ENV{'DISPLAY'}, -bg => 'black', ); $mw->withdraw; my $box = $mw->title('Test'); $box = $mw->geometry('-1+1'); $box = $mw->DialogBox( -title => 'Login', -buttons => [ 'OK', 'Quit' ], -fg => 'red', -default_button => 'OK', ); $box->add( 'LabEntry', -textvariable => \$uname, -width => 20, -bg => 'black', -fg => 'green', -label => 'Username', -labelPack => [ -side => 'left' ] )->pack; $box->add( 'LabEntry', -textvariable => \$pw, -bg => 'black', -fg => 'green', -width => 20, -label => 'Password', -show => '*', -labelPack => [ -side => 'left' ] )->pack; $box->Show( -popover => $mw ); MainLoop;
      Updated; Added $mw->withdraw

        I'm afraid that the geometry parameters that you are using, geometry('-1+1'), places $mw on the upper right of the main monitor. Thus the popup does appear correctly in the $mw. To see the problem I am fighting, change the geometry to ('+-300+1'). Now $mw appears on the left monitor, as it should, but the popup appears on the main monitor. In other words, geometry is working correctly but Show isn't.