0

Hello,

I would like to save the drawings I have made on a Canvas with the Tkinter Module.

Is it possible to make a .jpg or .gif or .bmp from a Tkinter window ?

Thank you!

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by vegaseat
0

Ok i've found the response on www.developpez.net
It uses the .postscript method from canvas and the ImageGrab module

Bonjour,
Il y a la méthode '.postscript', qui génère ... du postscript.
Sous MS windows, tu peux utiliser ImageGrab (PIL). Je ne crois pas que cela fonctionne sous Linux.
x = canvas.winfo_rootx()
y = canvas.winfo_rooty()
w = canvas.winfo_width()
h = canvas.winfo_height()
img= ImageGrab.grab((x+2, y+2, x+w-2, y+h-2)).save("tmp.bmp")

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.