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

add Screenshot script #164

Merged
merged 5 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
23 changes: 23 additions & 0 deletions text-to-sound/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# TEXT TO SOUND

Text-to-sound is a Python script for convert text to sound.

## Library used
- Pygame
- gTTS

## Setup

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

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

## Usage

```bash
cd text-to-sound
python text-to-sound.py
```
:thumbsup: :tada: Now make some noice from text!
2 changes: 2 additions & 0 deletions text-to-sound/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pygame==1.9.6
gTTS==2.1.1
20 changes: 20 additions & 0 deletions text-to-sound/text-to-sound.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import io
import pygame

from gtts import gTTS


def speak(text):
with io.BytesIO() as file:
gTTS(text=text, lang="en").write_to_fp(file)
file.seek(0)
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
continue


if __name__ == '__main__':
text = input("What should I say? :")
speak(text)