Jan-07-2018, 07:37 PM
(This post was last modified: Jan-07-2018, 07:37 PM by karaokelove.)
(Jan-07-2018, 03:01 PM)RandomCoder Wrote: Um, you could still type on other programs while the python is still running, you do realize that, right?
I believe he means in the same program. I ran your code (you don't need that "sec = 0", just fyi) and it does create a timer, but I can't interact with the program while it is counting down. I can still type in the console, but it has no effect on the program.
I believe what OP wants is something like a quiz program, where it might print a question and you only have 10 seconds to enter your input. I'm a noob, so I'm not sure how to accomplish this, though I imagine it would require at least one loop. I need to look into asynchronous Python, as @squensen mentioned.
[Edit] Just found this article on asynchronous programming. Starting to mess around with it right now.