Tcl/tk screenshot widget

Purpose:

A TclOO class which implements a screen shot widget capable to capture any portion of the screen area.

The screenshot functionality not only works “internally” inside tk widgets like for example the image create photo -format window -data $mywidget command, it can be used as a generic screen capture function.

screenshot.png

Implementation:

  • The screen picture is captured with the loupe utility function included in the treectrl (binary) package.
  • To save the image to various image file formats, the Img package is not mandatory but recommended.

  • The code can be used nearly “stand alone”, so it might be useful for various other application, e.g. like a note taken application, etc…

Hints:

  • The code has only been tested on windows (so far).
  • A life example of how this function can be integrated in a real live application is the DBM application which is also available on this site.

Credits:

This code is based on and influenced by the ruler widget and screenruler dialog originally written by Jeffrey Hobbs. The aformentioned code is avaliable in tklib.

Please note that although the package contains a test script, it possibly will not work out of the box as there are some dependencies as mentioned above.

To overcome this limitation, some might want to use a battery-included binary or a full featured tcl/tk installation e.g. provided by Activestate.

  • The source is also published here: wiki.tcl.tk.
  • The source code of the latest version is available under the following download Link: screenshot0.2.2.zip