padawan_linuxero has asked for the wisdom of the Perl Monks concerning the following question:
#!Perl $^W = 1; use strict; use File::Copy; use Date::Parse; use Date::Format; use Tk::DialogBox; use Tk::BrowseEntry; use Tk::ResizeButton; use Tk::ProgressBar; use Tk::LabFrame; use Tk::LabEntry; use Tk::ROText; use Tk::HList; use Cwd; use Tk; #Optional Modules# if ($^O eq 'MSWin32') { eval { require Win32::Console; Win32::Console::Free() }; if ($@) { warn "Win32::Console is not installed.\n$@"; } } #Declarations# my $VERSION = 2.7; my $loadhistory = 0; my $sort_cnt = 3; my ($ftp, $port, $after_id,); my $cwd = cwd; #Main# open STDERR, ">PFTPc.log" or warn "Cannot create PFTPc.log\a\n$!"; my $mw = MainWindow->new(-relief => 'raised', -bd => 2,); $mw->title("Asociacion de Agentes Aduanales de Matamoros --- Valida +cion Automatica"); $mw->geometry("1024x764+4+25"); my $respuesta; &user_input($mw); &create_dropdown($mw); &list_dir_enviar($mw); &list_dir_enviados($mw); &list_dir_respuesta($mw); $mw->Button(-text => "Salir", -command => sub { exit })->pack(-side => 'bottom'); &Tk::MainLoop(); ############################################################## sub list_dir_enviar { $mw->repeat(5000, \&refresh1); } ################################################################## sub list_dir_enviados { # my $mw = MainWindow->new; my $box1 = $mw->Listbox( -relief => 'sunken', -height => 5, -setgrid => 0, ); my @items1 = glob "c:/AAAvalida/valida/enviados/*.*"; #my @items = qw(One Two Three Four Five Six Seven Eight Nine Ten Eleve +n Twelve); foreach (@items1) { $box1->insert('end', $_); } my $scroll1 = $mw->Scrollbar(-command => ['yview', $box1]); $box1->configure(-yscrollcommand => ['set', $scroll1]); $box1->pack(-side => 'left', -fill => 'both', -expand => 1); $scroll1->pack(-side => 'right', -fill => 'y'); } ################################################################### sub list_dir_respuesta { # my $mw = MainWindow->new; my $box2 = $mw->Listbox( -relief => 'sunken', -height => 5, -setgrid => 0, ); my @items2 = glob "c:/AAAvalida/valida/respuestas/*.*"; #my @items = qw(One Two Three Four Five Six Seven Eight Nine Ten Eleve +n Twelve); foreach (@items2) { $box2->insert('end', $_); } my $scroll2 = $mw->Scrollbar(-command => ['yview', $box2]); $box2->configure(-yscrollcommand => ['set', $scroll2]); $box2->pack(-side => 'left', -fill => 'both', -expand => 1); $scroll2->pack(-side => 'right', -fill => 'y'); } ###################################################################### +### sub refresh1 { my $box = $mw->Listbox( -relief => 'sunken', -height => 5, -setgrid => 0, ); my @items = glob "c:/test/*.*"; #my @items = qw(One Two Three Four Five Six Seven Eight Nine Ten Eleve +n Twelve); foreach (@items) { $box->insert('end', $_); } my $scroll = $mw->Scrollbar(-command => ['yview', $box]); $box->configure(-yscrollcommand => ['set', $scroll]); $box->pack(-side => 'left', -fill => 'both', -expand => 1); $scroll->pack(-side => 'right', -fill => 'y'); } sub user_input { my $mother = shift; my $label_wert = $mw->Label( -text => 'Tu respuesta :', )->place( -x => 10, -y => 10); my $entry_wert = $mw->Entry( -width => 20, )->place( -x => 80, -y => 10); } sub create_dropdown { my $mother = shift; # Create dropdown and another element which shows my selection my $dropdown_value; my $dropdown = $mother->BrowseEntry( -label => "Label", -variable => \$dropdown_value, )->pack; my $showlabel = $mother->Label( -text => "nothing selected", )->pack; # Configure dropdown $dropdown->configure( # What to do when an entry iws selected -browsecmd => sub { $showlabel->configure(-text => "Ha seleccionado: $dropdown +_value" ), }, ); # Populate dropdown with values foreach ( qw/Enviados Recibido Errores/ ) { $dropdown->insert('end', $_); } # Set the initial value for the dropdown $dropdown_value = "Enviados"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with Tk::Repeat
by zentara (Cardinal) on May 06, 2008 at 18:59 UTC | |
|
Re: Problem with Tk::Repeat
by moritz (Cardinal) on May 06, 2008 at 17:50 UTC | |
|
Re: Problem with Tk::Repeat
by TGI (Parson) on May 06, 2008 at 19:23 UTC | |
by padawan_linuxero (Scribe) on May 06, 2008 at 23:03 UTC | |
by TGI (Parson) on May 06, 2008 at 23:49 UTC | |
by zentara (Cardinal) on May 07, 2008 at 13:56 UTC | |
by padawan_linuxero (Scribe) on May 07, 2008 at 14:31 UTC | |
by padawan_linuxero (Scribe) on May 07, 2008 at 17:25 UTC | |
| |
|
Re: Problem with Tk::Repeat
by thundergnat (Deacon) on May 07, 2008 at 15:39 UTC | |
by zentara (Cardinal) on May 07, 2008 at 18:47 UTC |