Answer the question
In order to leave comments, you need to log in
How to implement a delayed trigger in Python?
Kind. In general, almost complete 0 in python ... Tell me who is not difficult how to implement a trigger with a delay in Python.
Essence of a question:
Is there any variable. It is set to false by default. At some point in time, it may be set to true. But After a certain period of time, the variable should become false again (for example, 1 sec).
And, if at the moment when the variable is assigned true, it is again assigned true, then the delay counter should go to its original position (for example, 1 sec.).
On JS, I would not ask, but here is a python, and I don’t swim in it from the word at all.
Thanks in advance. Preferably either the code or a link to the code. I'll figure it out later.
Answer the question
In order to leave comments, you need to log in
at some point in time it can be set to true
myvar = time.time() + interval
myvar > time.time() # True, по истечению интервала - станет False
And, if at the moment when the variable is assigned true, it is again assigned true, then the delay counter should go to its original position (for example, 1 sec.).
myvar = time.time() + interval
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question