[Tkinter-discuss] How to export the image drawn by canvas?

Michael Lange klappnase at web.de
Thu Oct 1 12:39:31 CEST 2009


Hi,

On Thu, 1 Oct 2009 08:42:48 +0800
Protosssword <xsxcn at hotmail.com> wrote:

> 
> Dears,:
> 
> I use canvas to make animation by continuously displaying objects.
> Now I want to export what is displayed in canvas to an image file
> (.bmp, jpeg,png,... is OK) Is there such function in tkinter and how
> can I attain this?
> 

You can use the canvases postscript() method to export the whole canvas
or a part of it to a postscript file or alternatively let postscript()
return the postscript data. If necessary, you can use PIL to convert
the postscript into png or jpeg or so.

I hope this helps

Michael



More information about the Tkinter-discuss mailing list