Uncaught exception from user code:
Can't call method "Button" on an undefined value at C:\Documents and Settings\Eoin\Desktop\calc.pl line 66.
####
Uncaught exception from user code:
Can't call method "Button" on an undefined value at C:\Documents and Settings\Eoin\Desktop\calc.pl line 52.
####
my $mw = new MainWindow(-title => 'Calc');
$mw->geometry("300x300");
my $topframe = $mw->Frame(-height => '60', -width => '300')->pack(-side => 'top', -expand => '0', -fill => 'x');
my $btmframe = $mw->Frame(-height => '225', -width => '300',)->pack(-side => 'left', -expand => '1', -fill => 'both');
push @rows, $btmframe->Frame()->pack( -expand => 1, -fill => 'both', -side => 'top') for (0..3);
my $display = $topframe->Entry(-justify => 'right',
-state => 'disabled',
-textvariable => \$calc)
->pack(-expand => '1',
-fill => 'x',
-pady => 30,
-padx => 20,
-side => 'right');
$mw->bind("" , sub { &keypress } );
for my $i (
qw/
7 8 9 * n*
4 5 6 - \
1 2 3 + =
0 . C / )
{
if($i eq '+' || $i eq '=')
{
$h = 2;
}
$button{$i} = $rows[$r]->Button(-text => "$i",
-width => '3',
-height => "$h",
-command => sub { &btnpress($i) })
->pack(-expand => 1,
-fill => 'both',
-padx => 2,
-pady => 2,
-side => 'left',
-ipadx => 5,
-ipady => 5);
$w++;
$h = 1;
if($w > 2){$w = 0; $r++;}
}
MainLoop;