Author image Slaven Rezić
and 1 contributors


Tk::WidgetDump - dump the widget hierarchie


In a script:

    use Tk::WidgetDump; # optional
    $mw = new MainWindow;
    $mw->WidgetDump; # usually before MainLoop

From the command line for a quick widget option test:

    perl -MTk -MTk::WidgetDump -e '$mw=tkinit; $mw->Button->pack; $mw->WidgetDump; MainLoop'


Tk::WidgetDump helps in debugging Perl/Tk applications. By calling the WidgetDump method, a new toplevel with the widget hierarchie will be displayed. The hierarchie can always be refreshed by the Refresh button (e.g. if new widgets are added after calling the WidgetDump method).

By double-clicking on a widget entry, the widget flashes and a new toplevel is opened containing the configuration options of the widget. It also displays other characteristics of the widget like children and parent widgets, size, position, geometry management and server parameters. Configuration values can also be changed on the fly. Furthermore it is possible:

  • to navigate to the children or parents

  • to call widget methods interactively

  • to display internal widget data with Tk::ObjScanner (if available)

If you want to call widget methods, you have to enter the method name with arguments only, e.g. (for creating a line on a canvas):


Because WidgetDump is a pseudo widget, it cannot be configured itself.


  • Changing configuration values

    Changes are not reflected in the configuration window, you have to hit the "Refresh" button.

  • Tk::WidgetDump does not follow the conventions of a "real" widget (ConfiSpecs etc.)

  • The number of open windows may be confusing


Slaven Rezic (