-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.py
More file actions
73 lines (54 loc) · 1.8 KB
/
GUI.py
File metadata and controls
73 lines (54 loc) · 1.8 KB
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
from tkinter import*
from PIL import Image,ImageTk
import speech_text
import action
root=Tk()
root.title("AI Assistant")
root.geometry("550x675")
root.resizable(False,False)
root.config(bg="#6F8FAF")
#ask fun
def ask():
user_val=speech_text.speech_to_text()
bot_val=action.action(user_val)
text.insert(END,'User--->'+user_val+"\n")
if bot_val !=None:
text.insert(END,"BOT<---"+str(bot_val)+"\n")
if bot_val== "ohk mam":
root.destroy()
def send():
send=entry.get()
bot=action.action(send)
text.insert(END,'User--->'+send+"\n")
if bot!=None:
text.insert(END,"BOT<---"+str(bot)+"\n")
if bot== "ohk mam":
root.destroy()
def del_text():
text.delete('1.0',"end")
#frame
frame=LabelFrame(root,padx=100,pady=7,borderwidth=3,relief="raised")
frame.config(bg="#6F8FAF")
frame.grid(row=0,column=1,padx=55,pady=10)
#textlabel
text_label=Label(frame,text="AI Assistant",font=("comic Sans ms",14,"bold"),bg="#356696")
text_label.grid(row=0,column=0,padx=20,pady=10)
#image
image=ImageTk.PhotoImage(Image.open("image/assist.png"))
image_label=Label(frame,image=image)
image_label.grid(row=1,column=0,pady=20)
#adding text
text=Text(root,font=('courier 10 bold'),bg="#356696")
text.grid(row=2,column=0)
text.place(x=100,y=375,width=375,height=100)
#entry widget
entry=Entry(root,justify=CENTER)
entry.place(x=100,y=500,width=350,height=30)
#button
Button1=Button(root,text="ASK",bg="#356696",pady=16,padx=40,borderwidth=3,relief=SOLID,command=ask)
Button1.place(x=70,y=575)
Button2=Button(root,text="Send",bg="#356696",pady=16,padx=40,borderwidth=3,relief=SOLID,command=send)
Button2.place(x=400,y=575)
Button3=Button(root,text="delete",bg="#356696",pady=16,padx=40,borderwidth=3,relief=SOLID,command=del_text)
Button3.place(x=225,y=575)
root.mainloop()