ImageGrab

G

gslm

root = tk.Tk()
def click():
x=button1.winfo_rootx()
y=button1.winfo_rooty()
image=PIL.ImageGrab.grab((x,y,x+260,y+250))
image.save( 'tmp.jpeg')
button1 = tk.Button(root, compound=tk.TOP,
width=60, height=50,bg='black', command=click)
button1.pack()
root.mainloop()

Hi! How can I save only the button area and then open this image file
and print this?

If you help, I'll be very happy!
Thanks and regards...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top