This repository was archived by the owner on Jun 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ # Screenshot
2+
3+ Screenshot is a Python script for taking a screenshot.
4+
5+ ## Library used
6+ - tkinter
7+ - PyAutoGUI
8+
9+ ## Setup
10+
11+ Install the packages listed in ` requirements.txt ` using ` pip `
12+
13+ ``` bash
14+ pip install -r requirements.txt
15+ ```
16+
17+ ## Usage
18+
19+ ``` bash
20+ cd screenshot
21+ python screenshot.py
22+ ```
Original file line number Diff line number Diff line change 1+ PyAutoGUI == 0.9.50
2+ tk == 0.1.0
Original file line number Diff line number Diff line change 1+ import tkinter as tk
2+ from tkinter import messagebox
3+ import pyautogui
4+ import os
5+
6+
7+ root = tk .Tk ()
8+ time = tk .IntVar ()
9+ time .set (3 )
10+
11+
12+ def take_shot ():
13+ timeleft = time .get ()
14+ if timeleft > 0 :
15+ timeleft -= 1
16+ time .set (timeleft )
17+ root .after (1000 , take_shot )
18+ else :
19+ s = pyautogui .screenshot ()
20+ # Save a screenshot on current working directory
21+ s .save (os .getcwd () + "shot.png" )
22+ messagebox .showinfo ("Screenshot" , "Screenshot saved!" )
23+ time .set (3 )
24+
25+
26+ L = tk .Label (root , textvariable = time , fg = "blue" )
27+ L .pack ()
28+
29+ b = tk .Button (root , text = "Take Screenshot 3 secs" , command = take_shot )
30+ b .pack ()
31+
32+ root .mainloop ()
You can’t perform that action at this time.
0 commit comments