neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
I am not familiar with the 'flow' of widgets and windows which makes it hard for me to generate code. Could some kind monks please help me? Here is what I have so far:
#!/usr/bin/perl use warnings; use strict; use Tk; #flashcards for multiplication tables #Neil H watson #Tue Jul 15 20:24:47 EDT 2003 #upper time table limit my $scale; my $table; my ($score, $guess, $num1, $num2, $answer); #define main window my $mw = MainWindow->new; $mw->title("Times Table"); #scale to select upper limit (up to 12) $mw->Scale(-from => 1, -to => 12, -variable => \$scale)->pack(-side => 'left'); question(); #guess widget $mw->Entry(-width => 3, -takefocus => 1, -textvariable => \$guess)->pack(-side => 'right'); #question widget $mw->Label(-text => "$num1 X $num2 =")->pack(-side => 'right'); #checking if ($answer == $guess) { $score++ }else{ $score-- } MainLoop; sub question { $table = $scale->get(); $num1 = int(rand($table)+1); $num2 = int(rand(12)+1); $answer = $num1*$num2; }
It doesn't do alot at this point (very rough code). Here are my questions:
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newbie Perl/Tk help
by Mr. Muskrat (Canon) on Jul 17, 2003 at 15:41 UTC | |
|
Re: Newbie Perl/Tk help
by cbro (Pilgrim) on Jul 17, 2003 at 15:40 UTC |