Tk::FileEntry - FileEntry widget with optional file selection box


    use Tk::FileEntry;

    $fileentry = $parent->FileEntry(
        -filebitmap     => BITMAP,
        -command        => CALLBACK,
        -variable       => SCALARREF,


FileEntry is a composite widget for choosing files. It features a Tk::Label, Tk::Entry, and a Tk::Button.

When the button is clicked, a dialog for choosing a file will show up. The path of the chosen file will be inserted into the entry widget. The label is intended as caption for the entry widget.

This is useful if you want to provide a convenient way to select a file path.


Option: -filebitmap
Name: fileBitmap
Class: FileBitmap

Specifies the bitmap to be used for the button that invokes the File Dialog.


A callback that is executed when a file is chosen.

Pressing enter in the entry widget will execute this callback. See "BINDINGS" in Tk::FileEntry.


Reference to variable that will be bound to the value of the entry widget. See Tk::options for more details on -variable.


Defines the label text. Defaults to File:.


Tk::FileEntry has default bindings to allow the execution of the callback when a user presses enter in the entry widget.


  use strict;
  use warnings;
  use Tk;
  use Tk::FileEntry;
  my $mw = tkinit();
  $mw->FileEntry->pack(-expand => 1, -fill => 'x');


None yet. If you find one, please consider creating a bug report, e.g. via Github.


  • Tk::getOpenFile for details about the file selection dialog

  • Tk::Entry for details about the Entry widget

  • Tk for details about the Perl/Tk GUI library

There is a wiki for Tcl/Tk stuff on the web:


fileentry, tix, widget, file selector


Alexander Becker, <>

Original Author was Achim Bohnet <>.

This code is inspired by the documentation of FileEntry.n of the Tix4.1.0 distribution by Ioi Lam. The bitmap data are also from Tix4.1.0. For everything else:


Copyright (C) 2013-2020 by Alexander Becker

Copyright (c) 1997-1998 Achim Bohnet. All rights reserved.


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.3 or, at your option, any later version of Perl 5 you may have available.