From 261124fdfbc0a1b2b69784133a6d0b1bed6bd226 Mon Sep 17 00:00:00 2001 From: Naman Agarwal Date: Fri, 27 Oct 2017 17:49:20 +0530 Subject: [PATCH] Add a cool python script that allows the user to take a break after regular interval. --- Take_a_break/README.md | 7 +++++++ Take_a_break/take_a_break.py | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Take_a_break/README.md create mode 100644 Take_a_break/take_a_break.py diff --git a/Take_a_break/README.md b/Take_a_break/README.md new file mode 100644 index 0000000..750379a --- /dev/null +++ b/Take_a_break/README.md @@ -0,0 +1,7 @@ +# Take a Break + +> Helps user take some rest + +# Usage + +Allows the user to take a 10 minutes break after working continuously for 30 minutes. It automatically directs the user to a web page for 10 minutes and then closes the web page on its own. The script keeps the track of time on its own. diff --git a/Take_a_break/take_a_break.py b/Take_a_break/take_a_break.py new file mode 100644 index 0000000..ba974e4 --- /dev/null +++ b/Take_a_break/take_a_break.py @@ -0,0 +1,14 @@ +import time +import subprocess +import os +i = 0 +x = 3 +print(" The program started on " + time.ctime()) +while(i < x): + time.sleep(1800) + print(str(i + 1) + " break is taking place on " + time.ctime()) + p = subprocess.Popen(["firefox", "http://www.youtube.com"]) + time.sleep(600) + i = i + 1 + browserExe = "firefox" + os.system("pkill "+browserExe)