Hi all.

I'm trying to write a small GUI using Perl/Tk.
It should select a file, and than -  display it's name and by pressing
a button – do something.


After using my $inputfilename = $mw->getOpenFile(-filetypes =>
$types); all the buttons are un-clickable!

Here is my code:
==============================================================================

#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::DirTree;
use Cwd;


my $mw = MainWindow->new ();
   $mw->Label( -text => "Adding 949 field!" );

my $types = [
    ['MARC\XML Files',  ['.xml', '.mrc','mrcxml', 'xmlmrc']],
    ['All Files',        '*',             ],
    ];

    my $inputfilename = $mw->getOpenFile(-filetypes => $types);
    &see_inputfilename($inputfilename) if defined $inputfilename ;
    #---
    sub see_inputfilename {
         $mw->Label( -text => "$inputfilename" )->pack;
     }

    my $outputfilename = "$inputfilename"."_949.sav";
    &see_outputfilename($outputfilename)  if defined $outputfilename;
    #---
    sub see_outputfilename {
         $mw->Label( -text => "$outputfilename" )->pack;
     }

   $mw->Button( -text=>'Quit', -command=>sub{ exit } )->pack( -side=>'right' );
   $mw->Button( -text=>'Quit', -command=>sub{ exit } )->pack;

sub add_949_field {
    my ($inputfilename, $outputfilename) = @_;
    my $inputfilename_val = $inputfilename->get;
    my $outputfilename_val = $outputfilename->get;
    return "Taking inputfilename $inputfilename_val to add 949 field
into outputfilename $outputfilename_val\n";
    }

MainLoop;


==============================================================================


-- 
________________________________
 Oren Maurer
 http://www.meorero.org.il
 _______________________________
 # =======================|
 # Please avoid sending me Word |
 # or PowerPoint attachments |
 # =======================|
 # See: http://www.gnu.org/philosophy/no-word-attachments.html
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to