I want my messagebox to pop-up in the foreground over any application I'm running. Currently it pops-up in the background. I can tell only with the notification sound. I tried the toplevel, but I did not work. I'm running python 3.8
import time
from tkinter import *
from tkinter import messagebox
print("Testing program")
time.sleep(5)
print("Program tested")
window=Tk()
window.withdraw()
messagebox.showinfo('Successful','Script executed successfully')
window.deiconify()
window.destroy()
window.quit()
Here's the working code for anyone who needs:
import time
from tkinter import *
from tkinter import messagebox
print("Testing program")
time.sleep(5)
print("Program tested")
window=Tk()
window.attributes('-topmost',1)
window.withdraw()
messagebox.showinfo('Successful','Script executed successfully')
window.deiconify()
window.attributes("-topmost", True)
window.destroy()
window.quit()