In Tkinter, I have a window that I would like to create when a process is initialized to run another Python script, which would then close when the script completes. Below is what I have so far:
window = tk.Toplevel()
window.geometry("400x90")
window.wm_title("Process is Running")
process = subprocess.Popen("python3 run_a_script.py", shell=True)
process.wait()
window.destroy()
The script is running, but the popup window never appears. It does appear after the script completes if I remove window.destroy()
, but it does not automatically close.
Is there a way to have the window be created before run_a_script.py is run, and then have it automatically close when the script completes?