-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (33 loc) · 1.14 KB
/
main.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
# ------------------------------------
# https://github.com/vii33/TheWriter
# ------------------------------------
import sys, getopt
from tkinter import *
import theUI
def main(argv):
SPEECH_KEY = "KEY"
SERVICE_REGION = "westeurope"
mic_id = None
try:
opts, args = getopt.getopt(argv,"k:r:")
except getopt.GetoptError:
print ('main.py -k <AZURE_SPEECH_KEY> -r <AZURE_SERVICE_REGION> -m <MICROPHONE_HW_ID optional>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('main.py -k <AZURE_SPEECH_KEY> -r <AZURE_SERVICE_REGION> -m <MICROPHONE_HW_ID optional>')
sys.exit()
elif opt in ("-k", "--k"):
SPEECH_KEY = arg
elif opt in ("-r", "--r"):
SERVICE_REGION = arg
elif opt in ("-m", "--m"):
mic_id = arg
else:
assert False, "unhandled option"
# Initialize Window
root = Tk()
win = theUI.Window(master=root, speech_key=SPEECH_KEY,
service_region=SERVICE_REGION, mic_id=mic_id)
if __name__ == "__main__":
main(sys.argv[1:])