I want to save a snapshot of my running GUI window written in Python-tkinter.
For example, saving the image of the window by a click on the "Save" button in the given code.
import tkinter as tk
def set_text(val):
entry.delete(0,tk.END)
entry.insert(0,val)
return entry
def save_img():
pass
root = tk.Tk()
entry = tk.Entry(root,width=10)
entry.pack()
b1 = tk.Button(root,text="animal",command=lambda:set_text("Bird"))
b1.pack()
b2 = tk.Button(root,text="plant",command=lambda:set_text("Seed"))
b2.pack()
b3 = tk.Button(root,text="Save",command=save_img)
b3.pack(pady=20)
root.mainloop()
Thanks!