Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_screencopy.py
- from Tkinter import *
- from PIL import ImageTk, ImageGrab
- root = Tk()
- ww = 500
- hh = 500
- def screenshot():
- im1 = ImageGrab.grab((0, 0, ww, hh)) # bbox = (x1, y1, x2, y2)
- New = Toplevel(root, width=ww, height=hh)
- im1 = ImageTk.PhotoImage(im1)
- image1 = Label(New, image = im1)
- image1.image = im1
- image1.place(x=0, y=0)
- Button(root, text='ScreenShot', padx=1, command=screenshot).pack(padx=1, pady=1)
- mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement