Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can Python do that
#6
(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.
Reply


Messages In This Thread
Can Python do that - by hello_its_me - Dec-30-2017, 06:38 PM
RE: Can Python do that - by squenson - Dec-30-2017, 06:45 PM
RE: Can Python do that - by RandomCoder - Jan-07-2018, 02:02 PM
RE: Can Python do that - by squenson - Jan-07-2018, 02:31 PM
RE: Can Python do that - by RandomCoder - Jan-07-2018, 03:01 PM
RE: Can Python do that - by karaokelove - Jan-07-2018, 07:37 PM
RE: Can Python do that - by RandomCoder - Jan-08-2018, 02:33 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020