#!/usr/bin/perl -w
# 修改自 http://www.beedub.com/book/2nd/
# "Practical Programming in Tcl and Tk" 原作者 Brent Welch

use Tk;
use strict;

my ($main, $index, $x);

$main = MainWindow->new();
$index = 0;
foreach $x ("", qw(w e ew s ws es ews n nw ne new ns nws nes news)) {
    $main->{"f$x"} = $main->Frame(-bd=>2, -relief=>"ridge",
	-width=>40, -height=>40);
    $main->{"f$x"}->grid(-sticky=>"news",
	-row=>int($index/4), -column=>$index%4);
    $main->{"l$x"} = $main->Label(-text=>$x, -bg=>"white");
    $main->{"l$x"}->grid(-sticky=>$x, -padx=>2, -pady=>2,
	-row=>int($index/4), -column=>$index%4);
    ++$index;
}

MainLoop();

