Tk::SimpleFileSelect - Easy to Use File Selection Widget


  use Tk::SimpleFileSelect;

  my $fs = $mw -> SimpleFileSelect();
  my $file = $fs -> Show();          # Returns selected file's path name.



Font to display in the directory list and file name entry. The default is "*-helvetica-medium-r-*-*-12-*."


Width directory listing in average width units of the widget font. The default is 30.


Height in lines of the directory listing. The default is 14.


Name of initial directory to display. The default is '.' (current directory).


If non-zero, display files as well as directories. The default is 1 (display files).


If non-zero, display files that begin with '.'. The default is 0. (Don't display hidden files.)


Alternate text of the, "Accept," Button. The first character is underlined to correspond with an Alt- accelerator constructed from the first letter of the label.


Display only files matching this pattern. The default is "*" (all files).


Text to appear in the entry box when the widget is opened.


Tk::SimpleFileSelect is an easy to use file selection widget based on Tk::FileSelect. Unlike a Tk::FileSelect widget, Tk::SimpleFileSelect does not attempt to verify that a file exists. A Tk::SimpleFileSelect dialog returns the complete pathname of the selected file. The calling program is responsible for file validation and operations.

Clicking on an item in the List box selects the item and displays the text in the Entry box. Double clicking on a directory or entering its name in the Entry box changes to that directory.

Pressing Escape, Alt-C, or clicking the Cancel button closes the dialog and returns an empty string.

The Show() method causes the Tk::SimpleFileSelect to wait until a file is selected in the List box, a file name is entered in the text entry widget, or the, "Cancel," button is clicked.

Closing the dialog withdraws its window from the display. The widget must be deleted explicitly. The Show() method can open a Tk::SimpleFileSelect object that has already been created.

The return value of Show() is the pathname of a file selected in the List box, or the path of the filename in the text entry, or an empty string.




Release 0.68.

$Id:,v 1.5 2004/02/28 19:27:09 kiesling Exp $

Copyright © 2001-2004 Robert Kiesling,

Licensed under the same terms as Perl. Refer to the file, "Artistic."


Tk(1), perl(1).

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 321:

You forgot a '=back' before '=head1'

Around line 358:

Non-ASCII character seen before =encoding in '©'. Assuming ISO8859-1