-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
76 lines (51 loc) · 2.01 KB
/
gui.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
65
66
67
68
69
70
71
72
73
74
75
76
import Tkinter
import sr_final
import parser
import music
#functions to be called when buttons are clicked
def onMic():
sr_final.startRecognizer()
return
def onChangeBG():
return
def onPlayMusic():
music.get_link("angry")
return
#application window
root=Tkinter.Tk()
root.title("Desktop Buddy")
root.geometry("400x120")
root.resizable(width=False,height=False)
def onSubmit(obj1,obj2):
parser.UniversalParser(obj1.get("1.0",'end-1c'))
del(obj2)
return
def onManualEntry():
f1=Tkinter.Tk()#height=200,width=380)
etext=Tkinter.Text(f1,height=5,width=50)
submit=Tkinter.Button(f1,command=lambda: onSubmit(etext,f1),text="Submit",height=2,width=10)
etext.pack(side=Tkinter.TOP)
submit.pack(side=Tkinter.TOP)
f1.mainloop()
return
#parent frame
frame1=Tkinter.Frame(root)
#Tkinter.Frame(root,bg="black",bd=40,highlightbackground="blue",highlightcolor="yellow",highlightthickness=40)
frame1.pack(side=Tkinter.BOTTOM)
#buttons frame
bframe=Tkinter.LabelFrame(root,height=110,width=390,text="Pick an action",bd=4)
bframe.pack()
#accessory frame
frame2=Tkinter.Frame(bframe,height=90,width=280)
#buttons
b1=Tkinter.Button(frame2, command=onManualEntry,text="Manual entry", activeforeground="white",activebackground="gray",bd=4,fg="black",height=2,highlightcolor="green",relief=Tkinter.RAISED,width=30)
img=Tkinter.PhotoImage(file="mic.gif").subsample(8,8)
b2=Tkinter.Button(bframe,command=onMic,image=img,height=100,width=100,bd=4,relief=Tkinter.RAISED)
b2.pack(side=Tkinter.LEFT)
b3=Tkinter.Button(frame2,command=onPlayMusic,text="Play Mood-dependent Music",activeforeground="white",activebackground="gray",bd=4,fg="black",height=2,highlightcolor="green",relief=Tkinter.RAISED,width=30)
b3.pack(side=Tkinter.TOP)
b4=Tkinter.Button(frame2,command=onChangeBG,text="Change background",activeforeground="white",activebackground="gray",bd=4,fg="black",height=2,highlightcolor="green",relief=Tkinter.RAISED,width=15)
b4.pack(side=Tkinter.LEFT)
b1.pack(side=Tkinter.TOP,expand=False)
frame2.pack(side=Tkinter.LEFT)
root.mainloop()