screenshot taker python

Solutions on MaxInterview for screenshot taker python by the best coders in the world

showing results for - "screenshot taker python"
Safia
16 Sep 2020
1from tkinter.filedialog import *
2import pyautogui
3import tkinter
4
5root = Tk()
6root.title('Take A Screenshot')
7root.geometry('300x300')
8
9canvas = tkinter.Canvas(root, width=300, height=300)
10canvas.pack()
11
12
13def takeScreenshot():
14    img = pyautogui.screenshot()
15    savePath = asksaveasfilename()
16    if not ('.png' in savePath): savePath = savePath + '.png'
17    img.save(savePath)
18
19button = tkinter.Button(text="Take a Screenschot", command=takeScreenshot, font=10)
20canvas.create_window(150, 150, window=button)
21
22root.mainloop()
23