john.tm has asked for the wisdom of the Perl Monks concerning the following question:
perl scripterror message Tk::Error: Unable to open file: No such file or directory at C:\Users\ +aaaa.pl line 63. main::resthand at C:\Users\aaaa.pl line 63 Tk callback for .labframe.border.frame1.button Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 251 Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 175 <ButtonRelease-1> (command bound to event)
#!/usr/bin/perl use strict; use warnings; use File::Path qw( mkpath); use File::Copy qw(copy); use File::Copy qw(move); use Tk; use Tk::BrowseEntry; use Tk::LabFrame; use Tk::LabEntry; use Tk::Widget; my $test_bak = "G:\\temp\\Hand"; my @restore_files; opendir (DIR, $test_bak) or warn $!; while (my $restore_bak = readdir(DIR)) { push (@restore_files, "$restore_bak\n"); } closedir(DIR); my $restore_date = ''; my $mw = MainWindow->new(-title => " test ", -background =>'LightBlue2',-foreground=>'DarkBlue'); $mw->geometry("450x240"); #--------------------------------------------------------------------- +--------------------------------------- # create frames labels and buttons # #--------------------------------------------------------------------- +--------------------------------------- my $frame = $mw->LabFrame(-font => 'Times 08',-background =>'Light +Blue2', -labelside => "acrosstop",-foreground =>'Slategray +') ->pack(-side => 'top'); my $rest_sel = $frame ->BrowseEntry(-label => 'Select restore date + : ', -foreground=>'DarkBlue', -background =>'LightBlue2', -textvariable=> \$rest +ore_date) ->grid(-sticky => 'w', -column => 2, -row => 1 ); $rest_sel -> insert('end', @restore_files); my $restspace = $frame->Label(-text => ' ',-background =>'L +ightBlue2') ->grid(-sticky => 'e', -column => 4, -row => 1 ); my $restore_but = $frame -> Button(-text => " Restore ", -command +=>[\&resthand], -foreground=>'DarkBlue', -relief => 'raised', -background =>'LightBlue2', - +activebackground =>'DodgerBlue1' )->grid(-sticky => 'e', -column => 5, -row => 1 ); + my $textframe = $mw->Scrolled("Text", -scrollbars => 'e', -foregro +und=>'Green',-background => "Black", -height => 12) ->pack(-side => 'bottom', -fill => +'both'); tie *STDOUT, 'Tk::Text', $textframe; MainLoop; sub resthand { $|++; $textframe->delete("1.0", 'end'); printf " Restoring version $restore_date \n"; my $restore_to = "G:/temp/Hand/Hand.pl"; my $replace = "G:/temp/Hand/"; my $rest_string = join( "", "$replace", "$restore_date" ); print "$rest_string \n"; # check filehandles print "$restore_to \n"; copy ($rest_string, $restore_to) or die "Unable to + open file: $!"; $textframe->see('end'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl tk widget will not copy files
by poj (Abbot) on Aug 11, 2015 at 11:40 UTC | |
|
Re: perl tk widget will not copy files
by Anonymous Monk on Aug 11, 2015 at 04:12 UTC | |
|
Re: perl tk widget will not copy files
by Anonymous Monk on Aug 11, 2015 at 06:32 UTC | |
|
Re: perl tk widget will not copy files
by anonymized user 468275 (Curate) on Aug 11, 2015 at 09:35 UTC | |
by Corion (Patriarch) on Aug 11, 2015 at 09:41 UTC | |
by anonymized user 468275 (Curate) on Aug 11, 2015 at 09:52 UTC | |
by GrandFather (Saint) on Aug 11, 2015 at 12:04 UTC | |
by anonymized user 468275 (Curate) on Aug 12, 2015 at 09:23 UTC | |
|