다소 오래된 Tk 스크립트를 Tkx로 변환하면 화면 중심의 매개 변수로 전달 된 윈도우의 위치를 변경하는 다음 기능의 포트에 걸렸습니다. MainLoop을 호출하기 전에 이것을 호출했습니다. Tk가 reqwidth와 reqheight 값을 분명히 결정한 시점입니다.Perl Tkx에서 주 창의 위치를 어떻게 바꿉니 까?
sub CenterWindow
{
# Args: (0) window to center
# (1) [optional] desired width
# (2) [optional] desired height
my($window, $width, $height) = @_;
$window->idletasks;
$width = $window->reqwidth unless $width;
$height = $window->reqheight unless $height;
my $x = int(($window->screenwidth/2) - ($width/2));
my $y = int(($window->screenheight/2) - ($height/2));
$window->geometry($width . "x" . $height . "+" . $x . "+" . $y);
}
idletasks이 TKX :: 갱신() 필요한 경우에 변경 될 수 있습니다,하지만 난이 오래된 TK에 루틴의 창 특정 부분에 대한 명백한 번역을 찾기 위해 손실입니다. Tkx는 reqwidth, reqheight, screenwidth 또는 cue()가 검색 할 수있는 스크린 높이에 해당하는 것 같지 않습니다.
Tk의 팩 레이아웃이 아닌 Tkx에서 격자 레이아웃을 사용한다는 사실과 관련이 있습니까?
현재 Windows Vista에서 ActivePerl 5.10을 실행 중입니다.