in reply to PerlTk File Input

Hi!

It is better done as Joost mentioned, but if you really want to use an entry-widget, you could do it like this:
use Tk; my $file; my $top = new MainWindow; my $ent = $top->Entry(-textvariable=>\$file)->pack(); my $but = $top->Button(-text=>"ShowFile",-command=>\&sub_file)->pack() +; MainLoop(); sub sub_file { print $file; # or whatever }
Hope this helps,

mawe

Replies are listed 'Best First'.
Re^2: PerlTk File Input
by eserte (Deacon) on Jul 20, 2004 at 09:15 UTC
    Or even use Tk::PathEntry instead of Entry. This one lets you use the <Tab> key for completion as in modern shells.
Re^2: PerlTk File Input
by paul99 (Initiate) on Jul 22, 2004 at 09:35 UTC
    Thx,this works fine.