Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Newbie Perl/Tk help

by cbro (Pilgrim)
on Jul 17, 2003 at 15:40 UTC ( #275253=note: print w/replies, xml ) Need Help??

in reply to Newbie Perl/Tk help

Here is a small example that hints answers towards both of your questions.
#!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('<Key-Return>', \&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. }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://275253]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2018-05-25 05:45 GMT
Find Nodes?
    Voting Booth?