Subject: Re: making an image of each widget - DN [1]
Brian Meagher <bmeagher@eurologic.com> - 13 Apr 1999 - comp.lang.tcl
Hi John,
John Klassa wrote:
>
> I have an app that I developed with Tcl/Tk... I also have a tutorial for
> it, that I developed as a series of web pages with images of relevant parts
> of the main application. Alas, as generally happens, the tutorial is
> woefully out of date with respect to the application.
>
> I'd like to automate the process of creating an image (as, e.g., a GIF) of
> each toplevel window and menu in the application. I'm thinking that it
> should be possible to launch the application, then have (what should be a
> very short) script do "send" commands that will post each menu, create a
> snapshot, and so forth. With a series of images in hand, it'll be easy
> to update the tutorial; if I have to create each image manually (as I
> did for the first pass of the tutorial), things will get tedious in a
> hurry. :-)
>
> I'm looking for pointers to existing code...
I had similar thoughts a couple of years back (so there may be better tools
available now), and came up with the following to snapshot toplevels:
proc save_window {win filename {type gif}} {
raise $win
update
exec xsnap -region [winfo geometry $win] -xpm -file /tmp/xsnap.xpm
-noshow
exec xpmtoppm </tmp/xsnap.xpm >/tmp/xsnap.ppm
exec ppmto${type} </tmp/xsnap.ppm >$filename
}
If you want to snapshot a frame or widget WITHIN a toplevel I *think* that
you'll need to do a "winfo geometry $win" to get the dimensions and "winfo
rootx $win" and "winfo rooty $win" to get the screen position(, but I haven't
tested this).
The proc relies upon the following two software packages being installed on
your system:
xsnap
=====
A more recent version than mine is at
ftp://ftp.x.org/R5contrib/xsnap-pl2.tar.Z
Perhaps this newer version can save direct to gif, an eliminate the need for
netpbm?
netpbm
======
Available from:
ftp://ftp.x.org/R5contrib/netpbm-1mar1994.tar.gz
I run these under Linux, YMMV.
Regards,
-Brian.
---
Eurologic at NAB, Las Vegas, Nevada, Booth #S2618, April 19th-22nd 1999
http://www.eurologic.com
Last modified
1999-09-27
1999-09-27
(195.108.246.50)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
