Saving canvas from tkinter to file
问题 So I followed this post: How can I convert canvas content to an image? And when I tried to do as mentioned in the last suggestion, I get the following problem: When I call it out like this, the image/screenshot is taken too early and therefore the required image won't be captured. Here's the code: from tkinter import * from PIL import ImageGrab root = Tk() cv = Canvas(root) cv.pack() cv.create_rectangle(10,10,50,50) #cv.create_line([0, 10, 10, 10], fill='green') cv.update() #print(root.winfo