I'm new to python and i have been trying to find a simple way to pause an operating while-loop, making it possible to start it again from where it was paused. I have searched google for help and tips, but everything i find seems very complex. Is there a simple way to do this?
I've read that you can use termios and tkinter.
Im using ubuntu.
Sorry for language mistakes
Thanks!
Best Answer
Here's a simple tkinter program that runs in an infinite loop. Pressing space pauses/unpauses it, and pressing Esc quits.
Note: The following is for Python 2.x, if you're using Python 3, change
Tkinter
in the first line totkinter
(lower case t).This is a possible output, where I manually paused and unpaused the program twice before I quit.