Dear monks
I come with a question, seeking knowledge :), I being working
with Tk because I need it a graphic way to input data and display data too,
so right now I am working with Entry I am displaying data from a file to the Entry, the thing is that I added color to it, if it file has ACTIVE then it will be blue, when in the file has NON ACTIVE is red, but now I have a problem well look at the code :
sub Status_bancos {
#Banamex##########################################################
+#########################
my $etiqueta_info1 = $upperframe->Label(
-text => 'Santander :',
)->pack(-side => 'left',
-expand => 1);
my $archivo1 = "santa1.txt";
open(DAT0, $archivo1) || die("Could not open file!");
my @stat0=<DAT0>;
close(DAT0);
foreach my $stat0(@stat0)
{ chomp ($stat0);
my $banco0;
my $stado0;
($banco0,$stado0)=split(/\|/,$stat0);
if ($stado0 eq "ACTIVO"){
my $entry_info0 = $upperframe->Entry(
-foreground => 'blue',
-textvariable => \$stado0,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
}else{
my $entry_info0 = $upperframe->Entry(
-foreground => 'red',
-textvariable => \$stado0,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
}
}
my $label_info1 = $upperframe->Label(
-text => 'Banamex :',
)->pack(-side => 'left',
-expand => 1);
my $filename1 = "banamex.txt";
open(DAT1, $filename1) || die("Could not open file!");
my @stat1=<DAT1>;
close(DAT1);
foreach my $stat1(@stat1)
{ chomp ($stat1);
my $banco1;
my $stado1;
($banco1,$stado1)=split(/\|/,$stat1);
if ($stado1 eq "ACTIVO"){
my $entry_info1 = $upperframe->Entry(
-foreground => 'blue',
-textvariable => \$stado1,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
} else {
my $entry_info1 = $upperframe->Entry(
-foreground => 'red',
-textvariable => \$stado1,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
}
}
#HSBC#################################################################
+###################
my $label_info2 = $upperframe->Label(
-text => 'HSBC :',
)->pack(-side => 'left',
-expand => 1);
#---Extraccion de los datos de el archivo
my $filename2 = "hsbc.txt";
open(DAT2, $filename2) || die ("Could not open file");
my @stathsbc=<DAT2>;
close(DAT2);
foreach my $statushsbc (@stathsbc)
{
chomp($statushsbc);
my $banco2;
my $stado2;
($banco2,$stado2)=split(/\|/,$statushsbc);
if ($stado2 eq "ACTIVO"){
my $entry_info2 = $upperframe->Entry(
-foreground => 'blue',
-textvariable => \$stado2,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
} else {
my $entry_info2 = $upperframe->Entry(
-foreground => 'red',
-textvariable => \$stado2,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
}
}
#Banorte##############################################################
+#############
my $label_info3 = $upperframe->Label(
-text => 'Banorte :',
)->pack(-side => 'left',
-expand => 1);
my $filename3 = "banorte.txt";
open(DAT3, $filename3) || die("Could not open file!");
my @stat3=<DAT3>;
close(DAT3);
foreach my $stat3(@stat3)
{
chomp ($stat3);
my $banco3;
my $stado3;
($banco3,$stado3)=split(/\|/,$stat3);
if ($stado3 eq "ACTIVO"){
my $entry_info3 = $upperframe->Entry(
-foreground => 'blue',
-textvariable => \$stado3,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
} else {
my $entry_info3 = $upperframe->Entry(
-foreground => 'red',
-textvariable => \$stado3,
-width => 20,
)->pack(-side => 'left',
-expand => 1);
}
}
}
as you can see I have 8 Entries but visible there suppose
to be only 4 whether is RED o BLUE, but every time I run it
is displaying 5!!!!, the first one is the one that display 2 entries and I have type it, copy it but still same problem
Am I doing something wrong please help is very frustrating