in reply to Syntax error using Tk
First, you forgot a comma after 'ne' in your first pack.
Predeclare %button, and get rid of the my before $button{$i}.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->geometry("300x300"); my %button; my $ans = 'foobar'; my $num_screen = $mw->Entry(-width => 40, -state => 'disabled', -textvariable => "$ans") ->pack(-pady => 30, -anchor => 'ne', -side => 'top'); my @buttons = ( '9','8','7','6','5','4','3','2','1','0'); for (my $i = 9; $i >= 0; $i--) { $button{$i} = $mw->Button( -text => "$buttons[$i]", -width => '3', -height => '3', #-command => &numpress($i)) )->pack(-anchor => 'nw', -side => 'top'); } MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Syntax error using Tk
by flyingmoose (Priest) on Feb 16, 2004 at 15:43 UTC | |
by eoin (Monk) on Feb 16, 2004 at 18:53 UTC | |
by graff (Chancellor) on Feb 17, 2004 at 01:30 UTC |