Tk::Zinc::Debug - a perl module for analysing a Zinc application.


 perl -MTk::Zinc::Debug zincscript [zincscript-opts] [Debug-initopts]
 use Tk::Zinc::Debug;
 my $zinc = MainWindow->new()->Zinc()->pack;
 Tk::Zinc::Debug::init($zinc, [options]);


Tk::Zinc::Debug provides an interface to help developers to inspect Zinc applications.

Press the Escape key in the toplevel of your application to display the Tk::Zinc::Debug buttons bar.

Features :

o scan a rectangular area

Scan all items which are enclosed in a rectangular area you have first drawn by drag & drop, or all items which overlap it. Result is a Tk table which presents details (options, coordinates, ...) about found items; you can also highlight a particular item, even if it's not visible, by clicking on its corresponding button in the table. You can also display particular item's features by entering this id in dedicated entry field

o display items hierarchy

You can find a particular item's position in the tree and you can highlight items and see their features as described above. You can also generate the perl code corresponding to a selected branch (but images can't be reproduced).

o snapshot the application window

In order to illustrate a graphical bug for example.

o display coordinates of the X cursor.
o zoom/translate the top group

Loading Tk::Zinc::Debug as a plugin

If you load Tk::Zinc::Debug using the -M perl option, nothing needs to be added to your code. In this case, the init() function is automatically invoked with its default attributes for each instance of Zinc widget. You can overload these by passing the same options to the command.


init($zinc, ?option => value, ...?)

This function creates required Tk bindings to permit items search. You can specify the following options :

-optionsToDisplay => opt1[,..,optN]

Used to display some option's values associated to items of the tree. Expected argument is a string of commas separated options.

-optionsFormat => row | column

Defines the display format of option's values. Default is 'row'.

-snapshotBasename => string

Defines the basename used for the file containing the snaphshot. The filename will be <current­dir>/basename<n>.png Defaulted to 'zincsnapshot'.

-expandTagsField => 0 | 1

Specifies if the tags field in the attributes window will be expanded to show all the items tags (it should take up a lot of space). In the default case (value is set to 0), only the head of the list is displayed.


Daniel Etienne <>


Oct 5 2004 : transformations are correctly managed in built code. Transfo parameters can be displayed and set. new mode to display coordinateds of X cursor.

Oct 14 2003 : add a control bar, and zoom/translate new functionalities. finditems(), tree(), snapshot() functions become deprecated, initialisation is done using the new init() function.

Oct 07 2003 : contours of curves can be displayed and explored.

Sep 15 2003 : due to CPAN-isation, the ZincDebug module has been renamed Tk::Zinc::Debug

May 20 2003 : perl code can be generated from the items tree, with some limitations concerning transformations and images.

Mar 11 2003 : ZincDebug can manage several instances of Zinc widget. Options of ZincDebug functions can be set on the command line.

Jan 20 2003 : item's attributes can be edited.

Jan 14 2003 : ZincDebug can be loaded at runtime using the -M perl option without any change in the application's code.

Nov 6 2002 : some additional informations (like tags or other attributes values) can be displayed in the items tree. Add feedback when selected item is not visible because outside window.

Sep 2 2002 : add the tree() function

May 27 2002 : add the snapshot() function contributed by Ch. Mertz.

Jan 28 2002 : Zincdebug provides the finditems() function and can manage only one instance of Zinc widget.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 2981:

Non-ASCII character seen before =encoding in '<current­dir>/basename<n>.png'. Assuming CP1252