(Mar-31-2023, 09:58 PM)tester_V Wrote: Is there anything I can do to pause it?
Yes, there is a way. In Unix/Linux there is a rich number of signals you can send to a process. I am not sure what is implemented of it in Windows.
I understand you run your program from the terminal/dosbox, for you say you do a <Ctrl>C. This sends the signal SIGINT (Interrupt) to the process. You can catch those signals. Read all about it in "
signal — Set handlers for asynchronous events".
Example:
#! /usr/bin/env python3 import signal import time def handler(signum, frame): input("Progam paused. Hit enter to resume") return signal.signal(signal.SIGINT, handler) for i in range(10): print(i) time.sleep(1)Output:
$ ./signalexample.py 0 1 2 ^CProgam paused. Hit enter to resume 3 4 5 6 ^CProgam paused. Hit enter to resume 7 8 9