It doesn't work in the sense that the global $open varibale is not initialized and not recognized. In fact your script works fine alone but when i do the same in my script (your simply version) it doesn't print out the name of the file:
"Use of uninitialized value $fastafile in concatenation (.) or string at Desktop/script_perl/MIRNAWdelta.pl line 171.
selected file: " (blank).
Probably the problem is that the windows where are all the buttons considered since now are a new windows (soubbpoutin of a initial Get->start button) I mean:
# Entry Window
$init = my $mw = new MainWindow;
$label = $mw -> Label(...)
# The START button:
my $button = $mw -> Button(...,-command=>\push_button);
+
sub push_button { my $mw = new MainWindow;
$mw -> geometry ("1200x600");
# Menu bar
$mw->configure(-menu => my $menubar = $mw->Menu,
-background => 'white');
my $file = $menubar->cascade(-label => '~File');
my $edit = $menubar->cascade(-label => '~Edit');
my $help = $menubar->cascade(-label => '~Help');
my $open;
$mw-> Button (-text =>'Open', -command =>\&open_file)->place(-x=>240,
+-y=>35);
$mw-> Button (-text =>'Get Statistics', -command =>\&get_statistics)->
+place(-x=>320, -y=>35);
MainLoop;
sub open_file {$open = $mw->getOpenFile(
-filetypes => $types_OPEN,
-defaultextension => '.sff');
$te->Load( "$open");}
sub get_statistics {
my $fastafile= $open; print STDERR "selected file: $fastafile\n";
};
$te = $mw->Scrolled( .....); }
Maybe this the problem ?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.