in reply to Re^6: Perl tk - How to integrate external scripts
in thread Perl tk - How to integrate external scripts
Well, in what way does it "not work"?
Here's a minimal version that works in the sense that when you first click "Open" and select a file, and then click "Get Statistics", the latter routine prints the selected file name to the console. And if it can print the file name, it should also be able to do something else with it.
#!/usr/bin/perl -w use strict; use Tk; my $open; # declare global variable, my $mw = MainWindow->new(); $mw-> Button( -text =>'Open', -command => \&open_file )->pac +k(); $mw-> Button( -text =>'Get Statistics', -command => \&get_statistics ) +->pack(); MainLoop(); sub open_file { $open = $mw->getOpenFile(); # set it, } sub get_statistics { my $fastafile = $open; # and use it. print STDERR "selected file: $fastafile\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Perl tk - How to integrate external scripts
by Giorgio C (Novice) on Jan 31, 2012 at 12:53 UTC | |
by Eliya (Vicar) on Jan 31, 2012 at 14:06 UTC | |
by Giorgio C (Novice) on Jan 31, 2012 at 14:40 UTC | |
by Giorgio C (Novice) on Feb 01, 2012 at 11:35 UTC | |
by Anonymous Monk on Feb 01, 2012 at 11:38 UTC | |
by Giorgio C (Novice) on Feb 01, 2012 at 12:20 UTC | |
|