-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.py
61 lines (47 loc) · 2.4 KB
/
view.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
import controller as cntrl
import tkinter as tk
class viewClass:
def __init__(self):
self.c = cntrl.controller1()
self.root = tk.Tk()
self.var = tk.IntVar()
self.root.title("THE CLAPPER")
self.label2 = tk.Label(self.root, text = "Choose your mood:")
self.label2.grid(row = 0, column = 0,sticky = "n")
self.button1 = tk.Button(self.root,text = "listen", command = lambda:self.lstnfrmcntrl())
self.button1.grid(row=3,column=3)
self.button2 = tk.Button(self.root, text = "Play Recording", command = lambda: self.playrecording())
self.button2.grid(row=3, column = 2)
self.radio1 = tk.Radiobutton(self.root, text = "Party",value = 1,variable = self.var,activeforeground = "purple",
selectcolor = "purple").grid(row = 2, column = 0)
self.radio2 = tk.Radiobutton(self.root, text = "Romantic", value = 2, variable = self.var, activeforeground = "red",
cursor = "heart",selectcolor = "red").grid(row=2,column=1)
self.radio3 = tk.Radiobutton(self.root, text = "Relaxing", value = 3, variable = self.var, activeforeground = "white",
selectcolor = "white").grid(row=2, column=2)
self.radio4 = tk.Radiobutton(self.root, text = "Record" , value = 4, variable = self.var, activeforeground = "green",
selectcolor = "green").grid(row= 2, column = 3)
def mainLoop(self):
self.root.mainloop()
def lstnfrmcntrl(self):
if (self.var.get()== 1) and (self.listentoit() == True):
print(self.var.get())
self.root.destroy()
self.c.playA()
elif (self.var.get()==2) and (self.listentoit() == True):
print(self.var.get())
self.root.destroy()
self.c.playB()
elif (self.var.get()==3) and (self.listentoit() == True):
print(self.var.get())
self.root.destroy()
self.c.playC()
elif (self.var.get() == 4) and (self.listentoit() == True):
print(self.var.get())
self.root.destroy()
self.c.recordit()
def listentoit(self):
if self.c.listening():
return True
def playrecording(self):
self.root.destroy()
self.c.playrecord()