-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot.py
More file actions
28 lines (19 loc) · 775 Bytes
/
screenshot.py
File metadata and controls
28 lines (19 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import tkinter as tk
import pyautogui as pg
from tkinter import messagebox
root = tk.Tk()
root.title("Screenshot with Tkinter")
root.geometry("330x300")
def screenshot():
screenshots = pg.screenshot()
screenshots.save('image.png')
tk.messagebox.showinfo("Done", "Screenshot Captured ")
# Label
tk.Label(root, text="Screenshot with Tkinter", fg="Red", font="Arial 14 bold").grid(row=0, column=1, padx=40, pady=40)
# Capture Button
capture = tk.Button(root, text="Capture", bd=2, command=screenshot)
capture.grid(row=1, column=1, columnspan=3, pady=20, padx=40)
# Quit Button
button_quit = tk.Button(root, text="Exit Program", command=root.quit)
button_quit.grid(row=3, column=1, columnspan=3, pady=20, padx=20)
root.mainloop()