How to make the bot's reply to "hello"after 2seconds of saying"hai".? I used sleep(2) inside the sent().but failed.i need when the user text hai it's needed to print and after 2seconds the bot reply hello.. what can I do for getting this as o/p?
from tkinter import *
root=Tk()
ABC =Frame(root,bg='#010101',bd=20,relief=RIDGE)
ABC.grid()
def sent():
txt =Text(ABC,height=2,width=40,padx=10,pady=10)
txt.tag_config("right", justify="right")
txt.pack()
v=e.get()
sent="You => " + v
txt.insert(END,"\n"+sent)
if v=='hai':
txt =Text(ABC,height=2,width=40,padx=10,pady=10)
txt.tag_config("right", justify="right")
txt.pack()
a='hello'+" <== Bot "
txt.insert(END,"\n"+a,"right")
txt.config(state=DISABLED)
e.delete(0,END)
ABC1=Frame(root,bd=20,)
ABC1.grid()
#txt.tag_configure("green", foreground="green")
#txt.grid(column=0,row=0)
e =Entry(ABC1,width=30,bd=2,insertwidth=5,font=("aril",7))
e.grid(row=1,column=0)
b =Button(ABC1,text='sent',command=sent)
b.grid(row=1,column=1)
root.mainloop()