-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
79 lines (56 loc) · 2.11 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
77
78
79
from tkinter import*
from PIL import Image , ImageTk
import speech_to_text
import action
root = Tk()
root.title("AI Assistant")
root.geometry("600x690")
root.resizable(False , False)
root.config(bg="#6F8FAF")
#ask fun
def ask ():
user_val = speech_to_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 == "Ok sir" :
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 == "Ok sir" :
root.destroy()
def del_text():
text.delete("1.0" , "end")
# fame
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)
# text labor
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)
# imrage
image = ImageTk.PhotoImage(Image.open("assitant.png"))
image_label= Label(frame , image=image)
image_label.grid(row =1, column = 0 , pady = 20 )
# Adding tuxt
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 (salman bhai)
entry = Entry(root , justify=CENTER)
entry.place(x= 100 , y = 500 , width = 350 , height = 30)
# button 1
Button1 = Button(root,text ="ASK" , bg="#356696" , pady=16 , padx =40 ,borderwidth=3 , relief=SOLID ,command=ask)
Button1.place(x=70 , y= 575)
# button 2
Button2 = Button(root,text ="Send" , bg="#356696" , pady=16 , padx =40 ,borderwidth=3 , relief=SOLID ,command=Send)
Button2.place(x=400 , y= 575)
# button 3
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()