Screenshot in Tkinter

Eric Brunel eric.brunel at pragmadev.com
Mon Jan 7 05:06:33 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). Grzegorz

If what you're trying to print is the contents of a canvas, and if you have 
a PostScript printer, there is also a "postscript" method on Tkinter 
canvases that may interest you. It just returns the postscript code 
corresponding to the contents of the canvas.
And if you don't have a PostScript printer, there are many conversion 
utilities that may convert the PostScript to almost any other format. See 
for example the "convert" utility that's part of ImageMagick @ 
http://www.imagemagick.org

HTH
 - eb -



More information about the Python-list mailing list