padawan_linuxero has asked for the wisdom of the Perl Monks concerning the following question:
this data someone perhaps me or somebody else is going to change it as the status of the bank changes, and the program must go every 3 or 5 minutes to check the file and change the value in the entry, and I need the program that I am working on to be able to read the file and fill the 4 Entry's I have right now in the programbank1:Active bank2:Non Active bank3:Active bank4:Active
So basicly I need to add this to the program : I need to conect to the server and read a file using IO::Socket then put the data on the Entry for all 4 banks.#!/usr/bin/perl -W use strict; use warnings; use Tk; use Tk::BrowseEntry; use Cwd; use List::Util qw(shuffle); my $mw = MainWindow->new( -relief => 'raised', -bd => 2, ); $mw->title("Asociacion de Agentes Aduanales de Matamoros --- Validacio +n Automatica"); $mw->geometry("1024x764"); my $upperframe = $mw->Frame()->pack(-fill=>'x' ); my $topframe = $mw->Frame()->pack(-fill=>'x' ); my $mainframe = $mw->Frame()->pack(-expand=>1, -fill=>'both' ); my $bottomFrame = $mw->Frame()->pack(-fill=>'x'); my $exit_b = $topframe->Button(-text=>'Exit', -command=> sub{ exit } )->pack(-side => 'right', -padx=>20 +); my $label_wert1 = $upperframe->Label( -text => 'Banamex :', )->pack(-side => 'left', -expand => 1); my $entry_wert1 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert2 = $upperframe->Label( -text => 'HSBC :', )->pack(-side => 'left', -expand => 1); my $entry_wert2 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert3 = $upperframe->Label( -text => 'Banorte :', )->pack(-side => 'left', -expand => 1); my $entry_wert3 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert4 = $upperframe->Label( -text => 'Santander :', )->pack(-side => 'left', -expand => 1); my $entry_wert4 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $text1 = $topframe->Label(-text => "Archivos Por enviar")->pack(-si +de => 'left', -expand => 1); my $text2 = $topframe->Label(-text => "Archivos Por Enviados")->pack(- +side => 'left', -expand => 1); my $text3 = $topframe->Label(-text => "Archivos de Respuesta")->pack(- +side => 'left', -expand => 1); my $text4 = $bottomFrame->Label(-text => "Noticias")->pack(-side => 't +op', -expand => 1); my $box1 = Build_Listbox_One($mw); my $box2 = Build_Listbox_Two($mw); my $box3 = Build_Listbox_Three($mw); my ($enviar, $enviados, $respuestas) = Start_Directory_Monitors( $mw, +$box1, $box2, $box3 ); my $box4 = Build_Listbox_Four($mw); Tk::MainLoop(); sub Build_Listbox_One { my $box1 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box1; } sub Build_Listbox_Two { my $box2 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box2; } sub Build_Listbox_Three { my $box3 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box3; } sub Build_Listbox_Four { my $box4 = $bottomFrame->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box4; } sub Start_Directory_Monitors { my $mw = shift; my $enviar_display = shift; my $enviados_display = shift; my $respuesta_display = shift; my $enviar = $mw->repeat(5000, [ \&list_dir_enviar, $enviar_di +splay ] ); my $env = $mw->repeat(5000, [ \&list_dir_enviados, $enviados_d +isplay ] ); my $res = $mw->repeat(5000, [ \&list_dir_respuesta, $respuesta_ +display ] ); return $enviar, $env, $res; } # monitor enviados sub list_dir_enviar { my $box = shift; $box->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/enviar/*.*"; foreach (@items) { $box->insert('end', $_); } } sub list_dir_enviados { my $box1 = shift; $box1->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/enviados/*.*"; foreach (@items) { $box1->insert('end', $_); } } sub list_dir_respuesta { my $box2 = shift; $box2->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/respuestas/*.*"; foreach (@items) { $box2->insert('end', $_); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get data from a file and put it in a Tk Entry
by apl (Monsignor) on May 08, 2008 at 19:00 UTC | |
|
Re: Get data from a file and put it in a Tk Entry
by pc88mxer (Vicar) on May 08, 2008 at 19:02 UTC | |
|
Re: Get data from a file and put it in a Tk Entry
by starbolin (Hermit) on May 08, 2008 at 19:07 UTC | |
|
Re: Get data from a file and put it in a Tk Entry
by zentara (Cardinal) on May 08, 2008 at 19:35 UTC |