my $log = MainWindow->new(title=>"Who is logged on which tester"); my $log1 = $log -> Frame; $listbox = $log1->Scrolled("Listbox", "-font" => 14, "-width" => 51, "-height" => 37, "-background" => 'lightgreen'); foreach $n (@output){ $listbox-> insert('end',"$n");} $listbox -> pack(-fill => 'both',-expand => 1); $logU=$log1->Frame; $logU->Button( -text => 'Refresh', -background => 'lightgreen', -activebackground => '#0000ff', -activeforeground => '#80ffff', -command => sub{$Refr = 1;$log -> destroy;})->pack(-side => 'left',qw/-ipadx 4 -pady 2/ ,-expand => 1); $logU->Button( -text => 'OK', -background => 'lightgreen', -activebackground => '#0000ff', -activeforeground => '#80ffff', -command => \&exit)->pack(-side => 'right',qw/-ipadx 14 -pady 2/,-expand => 1); $logU->pack(-fill=>'both',-expand=>1,-side=>'bottom'); $log1 -> pack(-fill =>'both',-expand => 1); $log->withdraw; $log->update; my $xpos = int(($log->screenwidth - $log->width ) / 2); my $ypos = int(($log->screenheight - $log->height) / 3);#upper third instead of middle $log->geometry("+$xpos+$ypos"); $log->deiconify; # Show the window again $log-> bind ('','destroy'); $log-> bind ('','destroy'); $log->protocol('WM_DELETE_WINDOW',sub {$log->destroy;X_pressed();sleep(2);exit;}); MainLoop;