-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
49 lines (38 loc) · 945 Bytes
/
gui.py
File metadata and controls
49 lines (38 loc) · 945 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from tkinter import *
from tkinter import ttk
from dimits import Dimits
import os
from pygame import mixer
import sys
voice_name = ""
if len(sys.argv) > 1:
voice_name = sys.argv[1]
else:
print("No model specified.")
exit()
dt = Dimits(voice_name)
mixer.init()
def piper_kb(*args):
piper()
def clear_input(*args):
global T
T.delete('1.0', END)
def piper():
global dt
global mixer
input = T.get("1.0",END)
dt.text_2_audio_file(input, 'output', './output', format="wav")
sound = mixer.Sound("./output/output.wav")
sound.play()
root = Tk()
l = Label(root, text = "Quick Piper GUI v0.0.1")
T = Text(root, height = 5, width = 52)
citeste = Button(root, text = "Read", command = piper)
distruge = Button(root, text = "Exit", command = root.destroy)
l.pack()
T.pack()
citeste.pack()
distruge.pack()
root.bind('<Control-Return>', piper_kb)
root.bind('<Control-a>', clear_input)
root.mainloop()