I want to run a .exe file in windows (which I basically obtained using PyInstaller on a Python script in Windows). The exe, on running, pops a GUI window, where the user fills in some data.
I want that when the user click the close button, the GUI window gets destroyed and the remaining script continues to perform computation on data and log it somewhere (command prompt maybe?). The problem is that the process gets killed (or whatever it is technically called in Windows) when I click the close button.
This is particularly easy in Ubuntu, as when the Linux executable file of the same script (again obtained using PyInstaller on the script in Ubuntu 16.04) is run using the Terminal, clicking the close window does not kill the entire process but only acts as an event to trigger the later execution. Logging happens in the same terminal instance.
Is it possible to achieve this in Windows (maybe I can link the execution to command prompt or something)? I will be grateful if the answer draws parallelism with Ubuntu, as I am a beginner in Windows and only know the basics. Even if I use a dedicated button to submit the data, how can I close the GUI window (because it is not needed any more) and get the log from the later part of execution.
If it is of use:
Update 1: Minimum repr eg -
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text = "Close this window and you should see counting upto 10 in log")
label.pack()
root.mainloop()
# close clicked => root destroyed
for i in range(1,11):
print(i)
As suggested by @acw1688, removing the --windowed
flag solved the problem.