in reply to Re^6: Perl tk - open file and print content
in thread Perl tk - open file and print content
#!/usr/bin/perl use Tk; use strict; my $TOP = MainWindow->new; my $button = $TOP->Button(-text=> 'Print It' , -command => sub{ my $file_r = &fileDialog($TOP); print"\n selected this file $file_r\n"; # use whatever method you want to send # $file_r to the printer # like with Net::Cups print " printing now!\n"; # system( "lpr -lp0 -f $file_r"); #untested } )->pack(); MainLoop; sub fileDialog { my( $w ) = @_; my @types =( ["C files", [qw/.c++ .cpp .c/]], ["Log files", [qw/.log/]],, ["Text files", [qw/.txt/]], ["All files", '*'] ); my $file = $w->getOpenFile( -filetypes => \@types ); return($file); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Perl tk - open file and print content
by Giorgio C (Novice) on Jan 23, 2012 at 12:29 UTC | |
by Anonymous Monk on Jan 23, 2012 at 12:48 UTC | |
by Giorgio C (Novice) on Jan 23, 2012 at 14:44 UTC |