Author image Michael Carman


Tkx::FindBar - Perl Tkx extension for an incremental search toolbar


   use Tkx;
   use Tkx::FindBar;

   my $mw      = Tkx::widget->new('.');
   my $text    = $mw->new_text();
   my $findbar = $mw->new_tkx_FindBar(-textwidget => $text);

   $findbar->hide();  # remove until requested by user

   # Bindings to display and hide toolbar and navigate matches.
      '<Control-f>'  => 'show',
      '<Escape>'     => 'hide',
      '<F3>'         => 'next',
      '<Control-F3>' => 'previous',



Tkx::FindBar is a Tkx megawidget that provides a toolbar for searching in a text widget. Using a toolbar for a search UI is much less obtrusive than a dialog box. The search is done incrementally (also known as "find as you type"). The toolbar may be hidden and shown as needed.

Tkx::FindBar was inspired by the great find toolbar in Mozilla Firefox.


-textwidget => widget

Defines the widget to search in. This must be a text widget (or act like one).

-highlightcolor => color

Defines the background color used to highlight found text. The default value is #80FF80.


If set to 1 (the default) and the Tk tile package is available, the FindBar will be drawn using themed widgets to acheive a platform native appearance. If set to 0 or tiling is not available the standard widgets will be used instead.



Hides the FindBar widget.


Shows the FindBar widget if hidden and focuses the entry subwidget.


Finds the first instance of the search text.


Finds the next instance of the search text. (Searches forwards.)


Finds the previous instance of the search text. (Searches backwards.)


Shortcut method for bulk addition of bindings (e.g. to create keygboard shortcuts). The first argument is the widget to bind to. The remaining arguments are bind tag/method name pairs. Multiple tags may be bound to the same method.


The show and hide methods don't work with the place geometry manager. (The pack and grid geometry managers are supported.)

There's no support for configuring subwidgets.


Please report any bugs or feature requests to bug-tkx-findbar at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Tkx::FindBar

You can also look for information at:


Michael J. Carman, <mjcarman at>


Copyright (C) 2008-2009 by Michael J. Carman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The icons are Copyright (C) the Tango Desktop Project []. They are used under the terms of the Creative Commons Attribution-Share Alike License []. They're a heck of a lot better than anything I could come up with, so I'm grateful for being able to use them. Thanks, guys!