When the user clicks the 'X' in the top right of the terminal running the program, I want there to be a confirmation that they really want to exit the program.
So far, the most that I've found is this but that only works with 'ctrl-c', not clicking the 'X'. I've also found
def on_exit(sig, fun=None):
print("I can't prevent the exit")
win32api.SetConsoleCtrlHandler(on_exit, True)
Which would be perfect if it could prevent the exit.