Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
add Screenshot script (#164)
Browse files Browse the repository at this point in the history
* Add text-to-sound script

* fix failed check is about blank

* add screenshot script

* fix failed issues from screenshot.py

* fix again sorry
  • Loading branch information
bbetulkaya committed Oct 4, 2020
1 parent d0bf552 commit f1f2179
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
22 changes: 22 additions & 0 deletions screenshot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Screenshot

Screenshot is a Python script for taking a screenshot.

## Library used
- tkinter
- PyAutoGUI

## Setup

Install the packages listed in `requirements.txt` using `pip`

```bash
pip install -r requirements.txt
```

## Usage

```bash
cd screenshot
python screenshot.py
```
2 changes: 2 additions & 0 deletions screenshot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PyAutoGUI==0.9.50
tk==0.1.0
32 changes: 32 additions & 0 deletions screenshot/screenshot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import tkinter as tk
from tkinter import messagebox
import pyautogui
import os


root = tk.Tk()
time = tk.IntVar()
time.set(3)


def take_shot():
timeleft = time.get()
if timeleft > 0:
timeleft -= 1
time.set(timeleft)
root.after(1000, take_shot)
else :
s = pyautogui.screenshot()
# Save a screenshot on current working directory
s.save(os.getcwd() + "shot.png")
messagebox.showinfo("Screenshot", "Screenshot saved!")
time.set(3)


L = tk.Label(root, textvariable=time, fg="blue")
L.pack()

b = tk.Button(root, text="Take Screenshot 3 secs", command=take_shot)
b.pack()

root.mainloop()

0 comments on commit f1f2179

Please sign in to comment.