I have a program that, at one point, pops up a tkinter window. Once you close the window, the program continues. This is ok, but I need the program to close the window after 2 minutes if the user hasn't done so.
Since I use Pyinstaller, I understand that I need to use multiprocess instead of threading. Either way, when I call root.destroy() from a process, it fails because it can't find it ("name 'root' is not defined"; command line says this, IDLE says nothing).
I've spent hours researching how to implement this ""simple"" feature. I just want a quick fix. This wasn't even my original issue, originally the secondary process would bypass or "enter a value" into an "input()" in the main process so that it would continue, but I don't know how to do that either. If that's easier to solve, I'm up for it.
I've tried many things but I guess I'll just paste where I'm at:
from multiprocessing import Process
import time
import tkinter as tk
def func2():
global root
time.sleep(3)
root.destroy()
if __name__ == '__main__':
global root
root = tk.Tk()
T = tk.Text(root, height=20, width=60)
T.pack()
T.insert(tk.END, "test")
p2 = Process(target=func2)
p2.start()
tk.mainloop()
Thanks a lot,