#3 Water remainder Programme

 Water remainder Programme 

In this software, you simply have to enter the timing after you want to drink water and it will remind you 
by playing music and you have to enter stop to stop the music . in those time interval and also note the timings in the text file that in which time and which day you eat water how many times, and is it is useful to you or not.

If you want to download whole the file and data as well here is the link. Simply download the whole data files given below and after downloading copy the whole files in a separate folder and open your code editor software in this folder and enjoy the programme. 


Code For this program, Whole this code is written in Python file above.
Note = Please add a timing.txt file and a  ".wav" 'file in your directory while running this program
***************************
#importing some modules
from pygame import mixer
import time
import datetime
from win32com.client import Dispatch

number_of_glasses_left = 11
time_to_take_water = time.time()
#making function of play music which will stop or play music
def speak(str):
speak = Dispatch("SAPI.SpVoice")
speak.speak(str)
speak("Welcome, to health managment software.")
speak("Please Enter your name")
name = (input("Please enter your name = "))

speak(f"Hello {name} sir. I am a desktop assistant , created by Ashish sir . so that i can take care of your health. ")
speak("My work is to remind you, for drink water . after fix time so that, you remain healthy")
speak("You will find .date and time when you drink water. in past days in timing.txt file")
print("You can see the timings and date(full record) when you have drunk water in past days in timing.txt file ")
speak("Please ..enter water drinking time intervel in seconds")
duration = int(input("Please enter water drinking time intervel in seconds = "))
speak("My duty is ,to, give 11 glass of water, to you in a day")

def play_music(a):
mixer.init()
mixer.music.load(a)
mixer.music.play(-1)
while True:
a = input("to stop the music type (stop) and press enter = ")
if a=='stop':

mixer.music.stop()
# if person will stop music then calling loaddata() function to update file
load_data()
break
else:
mixer.music.play(-1)
#making a function that will add timing of water drinking in the timing.txt file
def load_data():
with open('timing.txt','a') as f:
n = f.write(f"the date and time of drinking water is {datetime.datetime.now()} \n")
return n
#making a loop which ends when no of water drinking glass become zero
while number_of_glasses_left!=0:
if time.time()-time_to_take_water>duration:#here the time to take drink water is after every 4 seconds you
# can adjust is according you and number of glass is also 2 which are adjustable
#it means if the difference between time when drink water and present time is greater than 7 seconds play music
print("Yeah!...Time to drink water")
play_music('water.wav')
time_to_take_water=time.time()
number_of_glasses_left-=1

***************************

Comments

Popular posts from this blog

# 1 Email Extractor