Skip to content

Commit fbbc482

Browse files
2 parents 1e182bb + e9e635b commit fbbc482

File tree

91 files changed

+1596
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1596
-12
lines changed

Age Calculator/Images/image4.png

55.9 KB
Loading

Age Calculator/Images/image5.png

57.4 KB
Loading

Age Calculator/Images/image6.png

61.2 KB
Loading

Age Calculator/Images/image7.png

53.8 KB
Loading

Age Calculator/README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,28 @@ I have mage this app using thinkter library. It can calculate your age as per th
2525
### DEMONSTRATION
2626

2727
1. Image1 - First image shows the app preview.
28-
![Image1](https://github.com/Abhay04ch/Play-With-Python/blob/main/Age%20Calculator/Images/Image1.jpg)
28+
![Image1](./Images/Image1.jpg)
2929

3030
2. Image2 - The user enter its date of birth and the age of the date to be calculated.
31-
![Image2](https://github.com/Abhay04ch/Play-With-Python/blob/main/Age%20Calculator/Images/Image2.jpg)
31+
![Image2](./Images/Image2.jpg)
3232

3333
3. Image3 - It displays the calculated age.
34-
![Image3](https://github.com/Abhay04ch/Play-With-Python/blob/main/Age%20Calculator/Images/Image3.jpg)
34+
![Image3](./Images/Image3.jpg)
3535

36+
4. Image4 - It shows the error message if the user enters a wrong month.
37+
![Image4](./Images/image4.png)
3638

37-
### YOUR NAME
39+
5. Image5 - It shows the error message if the user enters a wrong date.
40+
![Image5](./Images/image5.png)
3841

39-
### Abhay Chauhan
42+
6. Image6 - It shows the error message if the user enters a wrong year.
43+
![Image6](./Images/image6.png)
4044

45+
7. Image7 - It shows the error message if the user gives a blank input.
46+
![Image7](./Images/image7.png)
4147

4248

49+
### YOUR NAME
4350

51+
### Abhay Chauhan
52+
### Srihari S

Age Calculator/age_cal_prac.py

+91-5
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,104 @@ def clear():
1616

1717
# It checks all the input entries and returns Input Error if any entry is absent.
1818
def checkEntries():
19-
if (dayinput.get() == "" or monthinput.get() == ""
20-
or yearinput.get() == "" or seconddayinput.get() == ""
21-
or secondmonthinput.get() == "" or secondyearinput.get() == ""):
22-
23-
messagebox.showerror("Input Error")
19+
if (dayinput.get() == "" or monthinput.get() == "" or yearinput.get() == "" or seconddayinput.get() == "" or secondmonthinput.get() == "" or secondyearinput.get() == ""):
20+
messagebox.showerror("Input Error", "All fields are required")
21+
clear()
22+
return -1
2423

24+
if(int(dayinput.get()) > 31 or int(dayinput.get()) < 1):
25+
messagebox.showerror("Input Error", "Invalid Date")
26+
clear()
27+
return -1
28+
elif(int(monthinput.get()) > 12 or int(monthinput.get()) < 1):
29+
messagebox.showerror("Input Error", "Invalid Month")
30+
clear()
31+
return -1
32+
elif(int(yearinput.get()) < 1900):
33+
messagebox.showerror("Input Error", "Invalid Year, Enter a year greater than 1900")
34+
clear()
35+
return -1
36+
elif(int(seconddayinput.get()) > 31 or int(seconddayinput.get()) < 1):
37+
messagebox.showerror("Input Error", "Invalid Date")
38+
clear()
39+
return -1
40+
elif(int(secondmonthinput.get()) > 12 or int(secondmonthinput.get()) < 1):
41+
messagebox.showerror("Input Error", "Invalid Month")
42+
clear()
43+
return -1
44+
elif(int(secondyearinput.get()) < 1900):
45+
messagebox.showerror("Input Error", "Invalid Year, Enter a year greater than 1900")
46+
clear()
47+
return -1
48+
elif(int(monthinput.get()) == 2):
49+
if(int(dayinput.get()) > 29):
50+
messagebox.showerror("Input Error", "Invalid Date")
2551
clear()
2652
return -1
53+
elif(int(secondmonthinput.get()) == 2):
54+
if(int(seconddayinput.get()) > 29):
55+
messagebox.showerror("Input Error", "Invalid Date")
56+
clear()
57+
return -1
58+
elif(int(monthinput.get()) == 4 or int(monthinput.get()) == 6 or int(monthinput.get()) == 9 or int(monthinput.get()) == 11):
59+
if(int(dayinput.get()) > 30):
60+
messagebox.showerror("Input Error", "Invalid Date")
61+
clear()
62+
return -1
63+
elif(int(secondmonthinput.get()) == 4 or int(secondmonthinput.get()) == 6 or int(secondmonthinput.get()) == 9 or int(secondmonthinput.get()) == 11):
64+
if(int(seconddayinput.get()) > 30):
65+
messagebox.showerror("Input Error", "Invalid Date")
66+
clear()
67+
return -1
68+
elif(int(yearinput.get())%4 == 0):
69+
if(int(monthinput.get()) == 2):
70+
if(int(dayinput.get()) > 29):
71+
messagebox.showerror("Input Error", "Invalid Date")
72+
clear()
73+
return -1
74+
elif(int(secondyearinput.get())%4 == 0):
75+
if(int(secondmonthinput.get()) == 2):
76+
if(int(seconddayinput.get()) > 29):
77+
messagebox.showerror("Input Error", "Invalid Date")
78+
clear()
79+
return -1
80+
elif(int(yearinput.get())%100 == 0):
81+
if(int(monthinput.get()) == 2):
82+
if(int(dayinput.get()) > 28):
83+
messagebox.showerror("Input Error", "Invalid Date")
84+
clear()
85+
return -1
86+
elif(int(secondyearinput.get())%100 == 0):
87+
if(int(secondmonthinput.get()) == 2):
88+
if(int(seconddayinput.get()) > 28):
89+
messagebox.showerror("Input Error", "Invalid Date")
90+
clear()
91+
return -1
92+
elif(int(yearinput.get())%400 == 0):
93+
if(int(monthinput.get()) == 2):
94+
if(int(dayinput.get()) > 29):
95+
messagebox.showerror("Input Error", "Invalid Date")
96+
clear()
97+
return -1
98+
elif(int(secondyearinput.get())%400 == 0):
99+
if(int(secondmonthinput.get()) == 2):
100+
if(int(seconddayinput.get()) > 29):
101+
messagebox.showerror("Input Error", "Invalid Date")
102+
clear()
103+
return -1
104+
105+
# This function clears the previous result.
106+
def clearPrevious():
107+
finalDayoutput.delete(0, END)
108+
finalMonthoutput.delete(0, END)
109+
finalYearoutput.delete(0, END)
110+
27111

28112
# This function performs all the calculation and returns the calculated age.
29113
def calculateAge():
30114

115+
clearPrevious()
116+
31117
value = checkEntries()
32118
if value == -1:
33119
return

Alarm Clock/Readme.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
**Alarm Clock**
2+
3+
**GOAL**
4+
5+
The aim of this program is to set the alarm at a specific time(24Hrs format). When the time hits it will play sound.
6+
7+
**DESCRIPTION**
8+
9+
Set time in the app and click on set alarm. You can exit the app using exit button. Using TIME we are importing system time. Using playsound we will play the alarm sound. And using Tkinter we have created the GUI.
10+
11+
**LIBRARIES NEEDED**
12+
13+
- time
14+
- playsound
15+
- datetime
16+
- Tkinter
17+
18+
**HOW TO RUN**
19+
- from the terminal line run cmd <pre><code>python3 alarm.py</code></pre>
20+
21+
**DEMONSTRATION**
22+
23+
<img width="268" alt="img-1" src="https://user-images.githubusercontent.com/83280091/210274252-57ded7e6-f49c-4e1e-bf6f-a701d988d003.png">
24+
25+
**YOUR NAME**
26+
27+
Govind Kushwaha

Alarm Clock/alarm.mp3

1.48 MB
Binary file not shown.

Alarm Clock/alarm.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import datetime
2+
import time
3+
from tkinter import *
4+
from playsound import playsound
5+
6+
root = Tk()
7+
root.title("Alarm Clock")
8+
root.geometry("265x270")
9+
root.resizable(width=False,height=False)
10+
11+
# functions
12+
def setalarm():
13+
alarmtime=f"{hrs.get()}:{mins.get()}:{secs.get()}"
14+
# print(alarmtime)
15+
if(alarmtime!="::"):
16+
alarmclock(alarmtime)
17+
18+
def alarmclock(alarmtime):
19+
while True:
20+
time.sleep(1)
21+
time_now=datetime.datetime.now().strftime("%H:%M:%S")
22+
print(time_now)
23+
if time_now==alarmtime:
24+
Wakeup=Label(root, font = ('arial', 13, 'bold'),
25+
text="Time to Wake up!",fg="red").grid(row=10,columnspan=4)
26+
# print("wake up!")
27+
playsound('alarm.mp3')
28+
break
29+
30+
# GUI
31+
hrs=StringVar()
32+
mins=StringVar()
33+
secs=StringVar()
34+
35+
Label(root, font = ('arial', 16, 'bold'),
36+
text="Set Your Alarm Clock!").grid(row=1,columnspan=4)
37+
38+
Label(root, font = ('arial', 12, 'bold'),
39+
text="ENTER IN 24Hrs FORMAT").grid(row=2,columnspan=4)
40+
41+
42+
Label(root, font = ('arial', 11, 'bold'),
43+
text="Hour").grid(row=3,column=1)
44+
45+
hrbtn=Entry(root,textvariable=hrs,width=5,
46+
font =('arial', 18, 'bold')).grid(row=4,column=1)
47+
48+
Label(root, font = ('arial', 11, 'bold'),
49+
text="Minute").grid(row=3,column=2)
50+
51+
minbtn=Entry(root,textvariable=mins,width=5,
52+
font = ('arial', 18, 'bold')).grid(row=4,column=2)
53+
54+
Label(root, font = ('arial', 11, 'bold'),
55+
text="Second").grid(row=3,column=3)
56+
57+
secbtn=Entry(root,textvariable=secs,
58+
width=5,font = ('arial', 18, 'bold')).grid(row=4,column=3)
59+
60+
setbtn=Button(root,text="Set Alarm",command=setalarm,bg="#D4AC0D",
61+
fg="Black",font = ('arial', 19, 'bold')).grid(row=8,columnspan=4)
62+
63+
timeleft = Label(root,font=('arial', 20, 'bold'))
64+
timeleft.grid()
65+
66+
exit = Button(root,text="Exit",width=10, command=root.destroy, bg="#D4AC0D",
67+
fg="Black",font = ('arial', 19, 'bold'))
68+
exit.grid(row=9, columnspan=4)
69+
70+
mainloop()

Alarm Clock/images/img-1.png

123 KB
Loading

Alarm Clock/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## LIBRARIES NEEDED
2+
3+
import datetime
4+
import time
5+
from tkinter import *
6+
from playsound import playsound

Audio Book/Images/Audio_Book.mov

6.11 MB
Binary file not shown.

Audio Book/Images/gui.png

28.6 KB
Loading

Audio Book/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# AUDIO BOOK
2+
3+
4+
# GOAL
5+
6+
This is an Audio book program written in python. It converts pdf file to audio books, by extracting all text in the pdf file and converting it into speech.
7+
8+
# DESCRIPTION
9+
10+
This is a python Audio book.
11+
The program extract all texts from the pdf file and convert it into speech.
12+
13+
## How to use:
14+
+ Run the program
15+
+ Click on Browse and select any pdf file(which have extractalbe text)
16+
+ Enter the page number you want to start from in the page Entry
17+
+ Click on start to start the Audio book
18+
+ When your done listening click on stop to stop the Audio Book
19+
+ Close the window
20+
21+
# WHAT I HAD DONE
22+
23+
The program is written in python.
24+
It uses PyPDF2 to extract text from the pdf and then uses pyttsx3 to convert it into speech.It also tkinter for GUI and uses threading to run the function in an other thread to avoid freezing the GUI when the function runs.
25+
26+
# LIBRARIES NEEDED
27+
+ Tkinter
28+
+ pyttsx3
29+
+ PyPDF2
30+
+ Threading
31+
32+
# DEMONSTRATION
33+
![image](./Images/gui.png)
34+
35+
36+
37+
https://user-images.githubusercontent.com/82754813/210595903-f70b9dae-13db-4cae-9685-9c8ffbac9dba.mp4
38+
39+
40+
41+
42+
Mathew

Audio Book/main.py

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import pyttsx3 # text to speech
2+
import PyPDF2 as pdf # reading pdf
3+
import tkinter as tk # GUI
4+
from tkinter import filedialog # file selection
5+
import threading # Running both text to speech and GUI simultaneously
6+
7+
# creating tkinter instance and setting up text to speech
8+
root = tk.Tk()
9+
engine = pyttsx3.init()
10+
11+
# speech speed rate - change the value to increase or decrease speech rate
12+
engine.setProperty("rate", 200)
13+
14+
# tkinter variables
15+
stop = tk.BooleanVar()
16+
file = tk.StringVar()
17+
18+
19+
# file selection
20+
def browsefiles():
21+
filename = filedialog.askopenfilename(
22+
initialdir="/",
23+
title="Select a File",
24+
filetypes=(("PDF files", "*.pdf*"), ("all files", "*.*")),
25+
)
26+
chosenfile.configure(text="File Opened: " + filename)
27+
file.set(filename)
28+
29+
30+
# starting the reading
31+
def start():
32+
start_page = start_page_b.get()
33+
if start_page == "":
34+
start_page = 1
35+
start_page = int(start_page)
36+
filename = file.get()
37+
book = open(filename, "rb")
38+
reader = pdf.PdfReader(book)
39+
pages = len(reader.pages)
40+
for i in range(start_page - 1, pages):
41+
page = reader.pages[i]
42+
text = page.extract_text()
43+
lines = text.splitlines()
44+
for i in lines:
45+
engine.say(i)
46+
if stop.get():
47+
engine.stop()
48+
stop.set(False)
49+
break
50+
engine.runAndWait()
51+
break
52+
53+
54+
# to stop the reading
55+
def stopf():
56+
stop.set(True)
57+
58+
59+
# GUI setup
60+
root.geometry("480x270")
61+
root.title("Audio Book Reader")
62+
root.config(bg="#011627")
63+
title = tk.Label(root, text="Audio Book", font=("Arial", 20), fg="white", bg="#011627")
64+
title.pack(pady=20)
65+
button_explore = tk.Button(root, text="Browse Files", command=browsefiles)
66+
button_explore.pack()
67+
chosenfile = tk.Label(root, text="No file choosen", fg="white", bg="#011627")
68+
chosenfile.pack(pady=(0, 20))
69+
start_page_l = tk.Label(
70+
root, text="Enter the page number to start from:", fg="white", bg="#011627"
71+
)
72+
start_page_l.pack()
73+
start_page_b = tk.Entry(root)
74+
start_page_b.pack(pady=(0, 20))
75+
start = tk.Button(root, text="START", command=threading.Thread(target=start).start)
76+
start.pack()
77+
stopb = tk.Button(root, text="STOP", command=stopf)
78+
stopb.pack()
79+
root.mainloop()

Audio Book/requirments.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The required libraries are:
2+
Tkinter
3+
pyttsx3
4+
PyPDF2
5+
threading

CSV to JSON Converter/images/gui1.png

23 KB
Loading

CSV to JSON Converter/images/gui2.png

26.7 KB
Loading
37.5 KB
Loading
Loading

0 commit comments

Comments
 (0)