Answers for "screenshot taker python"

1

screenshot taker python

from tkinter.filedialog import *
import pyautogui
import tkinter

root = Tk()
root.title('Take A Screenshot')
root.geometry('300x300')

canvas = tkinter.Canvas(root, width=300, height=300)
canvas.pack()


def takeScreenshot():
    img = pyautogui.screenshot()
    savePath = asksaveasfilename()
    if not ('.png' in savePath): savePath = savePath + '.png'
    img.save(savePath)

button = tkinter.Button(text="Take a Screenschot", command=takeScreenshot, font=10)
canvas.create_window(150, 150, window=button)

root.mainloop()
Posted by: Guest on February-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language