try this (it is a better version of the link i suggested earlier):
use strict;
use Tk;
my $animal = getInput();
print $animal;
sub getInput {
my $input = "";
my $mw = MainWindow->new;
# Mainwindow: sizex/y, positionx/y
$mw->geometry("320x50+100+120");
# A label to show what to type in
my $label = $mw->Label(
-text => 'Your animal:',
);
$label->place( -x => 5, -y => 10);
# This is the text-userinput field
my $entry = $mw->Text(
# width is in characters, not pixel
-width => 20,
-height => 1,
);
$entry->place( -x => 80, -y => 10);
my $button = $mw->Button(
-text => 'Submit',
-width => 8,
-command => sub { chomp($input = $entry->Contents); destroy $mw; },
);
$button->place( -x => 230, -y => 10);
MainLoop;
return $input;
}
On Tue, Mar 9, 2010 at 9:20 PM, Richard Reina <richard at rushlogistics.com> wrote:
> Imran,
>> Thank you very much for you perlTk suggestion. I've been playing around with it and I like it. However, I have one big problem. I can't figure out how I can get the the values from buttons returned as a array or scalar. I execute the program and whoof! Where did the values I just selected go? If anyone has sample code of a very simple button that returns value, I would really appreciate it?
>> Thanks