-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
64 lines (53 loc) · 2.11 KB
/
test.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
"GUI test"
from tkinter import *
from tkinter import ttk
from PIL import Image, ImageTk
from test_record import *
from test_speaker import *
from profile import *
fname = "testfile.wav"
class Testing_file:
def __init__(self):
root = Toplevel()
root.title("Speaker Recognition(Test)")
width = root.winfo_screenwidth()
height = root.winfo_screenheight()
root.geometry("%dx%d" % (width, height))
root.state('zoomed')
## Resizable Image
image = Image.open('image\\test.gif')
global copy_of_image
copy_of_image = image.copy()
photo = ImageTk.PhotoImage(image)
global label
label = Label(root, image=photo)
label.place(x=0, y=0, relwidth=1, relheight=1)
label.bind('<Configure>', self.resize_image)
## Adding Buttons
recording_button = Button(root, fg="white", background="green", activebackground="green",
font=("Helvetica",20,'bold italic'), text='Record', padx=10, pady=10, command = record_audio)
recording_button.place(relx=0.5, rely=0.35, anchor=CENTER)
play_button = Button(root, fg="white", background="green", activebackground="green",
font=("Helvetica",20,'bold italic'), text='Play', padx=10, pady=10, command = self.audioplay)
play_button.place(relx=0.5, rely=0.5, anchor=CENTER)
test_button = Button(root, fg="white", background="green", activebackground="green",
font=("Helvetica",20,'bold italic'), text='Test', padx=10, pady=10, command = self.testaudio)
test_button.place(relx=0.5, rely=0.65, anchor=CENTER)
root.mainloop()
## Function for resizing the Image
def resize_image(self,event):
new_width = event.width
new_height = event.height
global copy_of_image
image = copy_of_image.resize((new_width, new_height))
global photo
photo = ImageTk.PhotoImage(image)
global label
label.config(image = photo)
label.image = photo
def audioplay(self):
global fname
play_audio(fname)
def testaudio(self):
k = test()
recog(k)