Using Message Boxes That Close Automatically
The function below shows a message box that disappears after the specified timeout (in seconds). The script execution then continues.
VBScript sample
Public Sub MsgBoxTimeout (Text, Title, TimeOut)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Popup Text, TimeOut, Title
End SubPython sample
import tkinter as tk
def msgbox_timeout(text, title="Message", timeout=0):
root = tk.Tk()
root.withdraw()
root.title(title)
dialog = tk.Toplevel(root)
dialog.title(title)
dialog.resizable(False, False)
tk.Label(dialog, text=text, padx=20, pady=15).pack()
tk.Button(dialog, text="OK", command=dialog.destroy).pack(pady=10)
dialog.update_idletasks()
if timeout > 0:
dialog.after(timeout * 1000, dialog.destroy)
dialog.wait_window()
root.destroy()
msgbox_timeout("hello world", "Greeting", 2)If TimeOut is 0, it behaves just like a normal message box. If TimeOut is greater than 0, the dialog box disappears after the specified number of seconds.

