I've got a script which creates a graph, but the script keeps running in the background until the window is closed. I'd like it to quit as soon as the window is created, so that Ctrl-C in the shell won't kill the window, and so that the user can leave the window open and continue working in the shell without bg
-ing it manually. I've seen some solutions with daemons, but I'd like to avoid splitting this into two scripts. Is multiprocessing the easiest solution, or is there something shorter?
The relevant show()
command is the last thing that is executed by the script, so I don't need to keep a reference to the window in any way.
Edit: I don't want to save the figure as a file, I want to be able to use the interactive window. Essentially the same as running mian ... &
in bash