-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpl.py
105 lines (72 loc) · 2.37 KB
/
pl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from gtts import gTTS
import os
import wikipedia
import tkinter
from tkinter import PhotoImage
from playsound import playsound
root =tkinter.Tk()
img=PhotoImage(file="wikipic.png")
img1=PhotoImage(file="python.png")
frame = tkinter.Frame(root,
bg="lightblue",
height=200)
frame.pack(fill=tkinter.X)
canvas=tkinter.Canvas(frame, width=1600,height=200)
canvas.place(x=0,y=0)
canvas.create_image(500,50, image=img1, anchor= 'nw')
frame2=tkinter.Frame(root,
bg="lightgreen",
height=650, width=600)
frame2.pack(fill=tkinter.X)
label=tkinter.Label(frame, text="text to speech using",
font="italic,60",
bg="white")
label.place(x=750,y=50)
label1=tkinter.Label(frame,text="SEARCH TO GET A SUMMARY FROM WIKIPEDIA ",
font="bold,30",
bg="#e6e8e6")
label1.place(x=600,y=0)
canvas=tkinter.Canvas(frame2, width=1600,height=650)
canvas.place(x=0,y=0)
canvas.create_image(50,50, image=img, anchor= 'nw')
entry=tkinter.Entry(frame2,
width=45,
bd= 4,font=45)
entry.place(x=550,y=50)
entry.insert(0,"")
#search fron wikipedia
def play():
srch=wikipedia.summary(entry.get())
op=gTTS(text=srch,lang='en',slow=False)
op.save("op.mp3")
path='op.mp3'
playsound(path)
os.remove('op.mp3')
os.kill()
def playtext():
op=gTTS(text=entry.get(),
lang="en",
slow=False)
op.save("op.mp3")
path='op.mp3'
playsound(path)
os.remove('op.mp3')
button2=tkinter.Button(frame2,text="speech",
width="15", pady=10,
font="bold,15",
command=playtext,bg="yellow")
button2.place(x=600,y=150)
#button3=tkinter.Button(frame2,text="stop",
# fornt="bold,15",command=stop,bg="yellow")
#button3.pla(x=750,y=0)
button=tkinter.Button(frame2, text = "Search",
width = "15", pady = 10,
font = "italic, 15",
command = play, bg='yellow')
button.place(x=800,y=150)
button3=tkinter.Button(frame2,text="QUIT",
width=10,pady=10,
command=quit,bg="yellow")
button3.place(x=750,y=250)
root.geometry("1500x1000")
root.mainloop()