Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created January 9, 2021 18:14
Show Gist options
  • Save JayantGoel001/8520fb0ed86c79224312a3fadaf1d229 to your computer and use it in GitHub Desktop.
Save JayantGoel001/8520fb0ed86c79224312a3fadaf1d229 to your computer and use it in GitHub Desktop.
Grab Screenshot using pyautogui and tkinter to create GUI
import pyautogui
from tkinter import *
win = Tk()
win.title("Grab ScreenShot")
canvas1 = Canvas(win, width=300, height=300)
canvas1.pack()
def myScreenShot():
ss = pyautogui.screenshot()
ss.save("ss.png")
button = Button(win, text='Grab A Screenshot', command=myScreenShot, bg='green', fg='white', font=15)
canvas1.create_window(150, 150, window=button)
win.mainloop()
@JayantGoel001
Copy link
Author

ss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment