Wise monks
I have being trying out Tk as a front end for a program I am working have learn a lot these days, but know I came to a problem that I really try to fix but just did not find how, you see I have a list of 4 Entry widgets all of them are created from a text file like this :
bank1|ACTIVE
bank2|NO ACTIVE
bank3|ACTIVE
and the program is this one:
sub make_entry1 {
my ($upframe,$labe2,$filename1) = @_;
my $label_info4 = $upframe->Label(
-text => 'Status :',
)->pack(-side => 'left',
-expand => 1);
open(DAT1, $filename1) || die("Could not open file!");
my @stat1=<DAT1>;
close(DAT1);
foreach my $stat1(@stat1)
{
chomp ($stat1);
my $operacion;
my $stado1;
($operacion,$stado1)=split(/\|/,$stat1);
my $label_display1 = $upframe->Label(
-textvariable => \$operacion
)->pack(-side => 'left',
-expand => 1);
if ($stado1 eq "ACTIVO"){
my $entry_info1 = $upframe->Entry(
-foreground => 'blue',
-textvariable => \$stado1,
-width => 20,
)->pack(-side => 'left');
#-expand => 1);
} else {
my $entry_info1 = $upframe->Entry(
-foreground => 'red',
-textvariable => \$stado1,
-width => 20,
)->pack(-side => 'left');
#-expand => 1);
}
}
}
As you can see I choose to create averything from the textfile becasue we add or take out a bank, but if you run this program you will see that at the end, that it repeat itself again and again , so my question is how to stop the widget entry from duplicating itself?
Thank you wise monks!