-
Notifications
You must be signed in to change notification settings - Fork 436
/
Copy pathmain.py
52 lines (38 loc) · 1004 Bytes
/
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
42
43
44
45
46
47
48
49
50
51
52
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from plyer import stt
from kivy.lang import Builder
Builder.load_string('''
<STTDemo>:
Button:
text: "Start listening"
on_release: root.start()
Button:
text: "Stop listening"
on_release: root.stop()
Button:
text: "Set Commands"
on_release: root.set_command()
Button:
text: "commands title"
on_release: root.commands_title()
Button:
text: "commands"
on_release: root.commands()
''')
class STTDemo(BoxLayout):
def start(self):
stt.start_listening()
def stop(self):
stt.stop_listening()
def set_command(self):
stt.set_commands()
def commands_title(self):
print stt.display_commands_title()
def commands(self):
print stt.display_commnds()
class SpeechToTextApp(App):
def build(self):
return STTDemo()
if __name__ == '__main__':
SpeechToTextApp().run()