-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain_script.py
More file actions
34 lines (25 loc) · 909 Bytes
/
main_script.py
File metadata and controls
34 lines (25 loc) · 909 Bytes
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
import tkinter as tk
from tkinter import *
import pyttsx3
import tkinter.font as tkFont
from PIL import Image, ImageTk
engine = pyttsx3.init()
window = tk.Tk()
window.resizable(width=False, height=False)
window.geometry("600x300")
window.title("Minor Project by Apoorv")
load = Image.open("logo.png")
render = ImageTk.PhotoImage(load)
img = Label(image=render)
img.image = render
img.place(relx=0.25,rely=0.02)
written = StringVar()
def speak():
to_say = str(written.get())
if len(to_say)>0:
engine.say(to_say)
engine.runAndWait()
Label(window,text="What to say : ",font=tkFont.Font(family="Lucida Grande", size=10)).place(relx=0.3,rely=0.5,anchor=tk.CENTER)
Entry(window,textvariable=written,width=30).place(relx=0.6,rely=0.5,anchor=tk.CENTER)
Button(window,text = "SPEAK !!",command = speak,width=20,height=2).place(relx=0.5,rely=0.8,anchor=tk.CENTER)
window.mainloop()