-
Notifications
You must be signed in to change notification settings - Fork 2
/
voice.py
66 lines (53 loc) · 1.93 KB
/
voice.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
import pyttsx3
import time
import os
import bluetooth
import serial
import tkinter
from pyttsx3 import *
from bluetooth import *
from tkinter import *
#from Arduino_Database import * # something wrong w
serial_speed = 9600
serial_port = 'COM7'
def speak(Engine, Database_info):
Engine.say(Database_info)
Engine.runAndWait() #future check if this command is necessary
#def movements_Arduino(): #which parameters?
# data = ser.readline()
# example = data.decode('utf-8')
# print(example)
# try:
# log.insert('1.0', example) # basic example of printing instead of the print function below
# except IndexError:
# print("RECEIVED INCOMPLETE DATA\n")
#def print_example(master, *args, **kwards):
# f = Frame(master, height = 20, width = 60)
# f.pack_propagate(0)
# label = Label (f, *args, **kwards)
# label.pack(fill=BOTH, expand=1)
class Database_RealWorld():
def movements_Database():
Database_info = 'word' #have a command to read what is being sent
if Database_info != " ": #need database to send " " when info is finished
log.insert(Database_info, " ")
speak(Engine, Database_info)
movements_Database() #call the function again to check if there are new words
if __name__ == '__main__':
ser = serial.Serial(serial_port, serial_speed, timeout=0)
Engine = pyttsx3.init()
master = Tk()
#master.wm_title("GloVoice")
#log = Text(master, width=30, height=35, takefocus=0)
#movements_Arduino()
data = ser.readline()
example = str(data.decode('utf-8'))
print("hey")
print(str(data))
ser.close()
#send = Arduino_Database()
#send.movements_Arduino()
# have a wait command between sending information and receiving it
#receive = Database_RealWorld()
#receive.movements_Database()
master.mainloop()