I made program to make images in Python tkinter Canvas, but I have no idea how to save images I created. It can be png, gif, anything, but I want to save my work!
This is my code:
import tkinter
from PIL import Image, ImageGrab
paint = tkinter.Tk()
paint.title('paint')
canvas = tkinter.Canvas(paint, width=1100, height=1000, bd=0, highlightthickness=0)
canvas.pack()
def capture(event):
x0 = canvas.winfo_rootx()
y0 = canvas.winfo_rooty()
x1 = x0 + canvas.winfo_width()
y1 = y0 + canvas.winfo_height()
im = ImageGrab.grab((100, 0, 1100, 1000))
im.save('mypic.png')
canvas.mainloop()
I deleted some of my code because it isn't important. But it makes a screenshot without my canvas!