Here is how I do it
$mw->Button (-text=>"run",
-command=> sub {test($rb_val,$bonobo,$oracleid)})->place(-x=>320,
-y=>250 ,-width=>75);
Laurent coudeur
Oliver Schaedlich <[EMAIL PROTECTED]>
15/12/2003 11:27
Please respond to Oliver Schaedlich
To: [EMAIL PROTECTED]
cc:
Subject: pass vars to sub via TK/Button
Greetings,
I'd like to know how to pass variables fetched by TK/entry to a
subroutine by using a Button. The Button/-command line in the
following script is obviously wrong, but should suffice to illustrate
what I want it to do.
I'd be happy if someone could tell me how to do this properly.
-----------
#! /usr/bin/perl -w
use strict;
use Tk;
my $main = MainWindow->new;
my $var1 = $main -> Entry( -width => 30 );
$var1 -> pack;
my $var2 = $main -> Entry( -width => 30 );
$var2 -> pack;
$main -> Button
( -text => 'Add',
-command => \&add_item($var1, $var2)
# ^^^^^^^^^^^^^^^^^^^^^^
) -> pack;
MainLoop;
sub add_item {
print "Added @_\n";
}
-----------
Best regards,
oliver.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>