Hi Coders,
I have the following piece of code:
$menub = $mw->Menubutton(-text => "Edit",
-menuitems => [["command" => "Parameters", -command
=>sub {
$param_win = MainWindow ->new;
$param_win ->title("Annealing parameters");
$param_win ->Label(-text => "Algorithm : Simulated
Annealing",
-background => "blue",-foreground => "white",
-relief => "raised")->pack();
$param_win ->Label(-text => "Initial Temperature:",
-foreground => "Blue")->pack();
$text1 = $param_win->Text(-width => '10', -height =>
'1')->pack;
$param_win ->Label(-text => "Final Temperature:",
-foreground => "Blue")->pack();
$text2 = $param_win->Text(-width => '10', -height =>
'1')->pack;
$param_win ->Label(-text => "Inner Loop Criterion:",
-foreground => "Blue")->pack();
$text3 = $param_win->Text(-width => '10', -height =>
'1')->pack;
$button = $param_win->Button(-activebackground =>
'blue',
-activeforeground => 'yellow', -text => "Save",
-command => sub {Echo ($entry, $text1,$text2,
$text3)})->pack();
}]])->place(-x => '30', -y => '0');
sub Echo {
($widget, $text1, $text2, $text3) = @_;
$initial_anneal_temp = $text1->Contents();
$final_anneal_temp = $text2->Contents();
$inner_loop_criteria = $text3->Contents();
print "$initial_anneal_temp $final_anneal_temp
$inner_loop_criteria\n";
}
under main.
I also have this code under main::
if ($initial_anneal_temp != "0"){
$init_temp = $initial_anneal_temp;
} else {
$init_temp = 400000;
}
if ($final_anneal_temp != "0"){
$final_temp = $final_anneal_temp;
} else {
$final_temp = 0.10;
}
if ($inner_loop_criteria != "0"){
$ni = $inner_loop_criteria;
} else {
$ni = 30;
}
$temp = $init_temp;
So there are entries made into Text widget, my program
should run with whatever is there in those entries.
Unfortunately, my program is always going with
defaults.
I do not know why?
Can you please help. I think my understanding of
local/global perl variables is skewed.
regards
Nikhil
___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs