Screenshot in Tkinter

Erik de Castro Lopo nospam at
Sun Jan 6 04:41:36 EST 2002

Grzegorz Dostatni wrote:
> Is it possible to get a screenshot (as a bitmap) in Tkinter, using Python?
> All I want is to be able to say - I want a screenshot of it for printing 
> (to a printer).

Since you are using SunOS and hence X-Windows, I would suggest you use the
common Unix command line utility xwd (X Window Dump) as follows.

   1) In an terminal window run "xwd >a.xwd" and you should notice the
      cursor changes shape.
   2) Now clock on the winod you want a screenshot of or the background
      to capture the whole screen.

This will create a file named "a.xwd" containing your screen shot. This can 
be loaded into a grphics editing packages like the Gimp for printing or

Hope this helps,
  Erik de Castro Lopo  nospam at (Yes it's valid)
Seen on usenet (possibly a quote from an IBM exec):
"Each large company needs its Vietnam, and Microsoft will
 experience it with NT..."

More information about the Python-list mailing list