Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://275253]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2016-09-25 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (473 votes). Check out past polls.