I want to display a messagebox with options Yes or No. If user doesn't select any option with in the TIMEOUT(ex:5 sec) Messagebox should be closed with default YES option . How can i achieve it ?
Below is the code i used but it resp
value is always False.
from Tkinter import *
import tkMessageBox
time = 2000
def status():
resp=True
root.destroy()
root = Tk()
root.withdraw()
root.after(time,status)
resp=tkMessageBox.askyesno(title='Test',message='Click Yes otherwise No',default=tkMessageBox.YES)
print resp
root.mainloop()
With the default
askyesno
messagebox you cannot do this. You can do this with a custom dialog like for example: