#!c:/perl/bin use Tk; use strict; my $main = MainWindow->new(); my $value; # # here is an example of how to catch the key return. # Again, this is just an example, but you will # see that you get into the calc() function every time # the user presses enter. $main->bind('', \&calc); # O/K now that the Enter key is bound to the # window, let's bind $value to the Scale and # also give Scale a function where we can access # it's members (e.g. the value of $value) $main->Scale('orient' => 'horizontal', '-from' => 0, '-to' => 12, '-tickinterval' => 1, '-label' => 'Select Time Table', '-variable' => \$value, '-command' => \&calc)->pack; MainLoop; sub calc { # remember this is just an example. # This prints to the console, but # it shows that you have access to the value. print $value . "\n"; # # Now that you're in the function, I'll leave # it up to you how to do the calculations, and # draw up/print a new question. # just know that you still have access to all of the # widgets that are part of the MainWindow. }