0

The code below will start to print the time if:

time.time() - start_time) >10 and Total_ratio > 5.0

but its only works once. How to make it work for every 10 seconds because its works only once.

    end_time = time.time() + 5
    if ((time.time() - start_time) >10 and Total_ratio > 5.0 ):
            cv2.putText(frame, "Closed", (50, 150), font, 7, (0, 255, 255), thickness=3)
            print(ctime())
           
            if time.time() > end_time:
                break
nima
  • 7,796
  • 12
  • 36
  • 53

1 Answers1

0

Change as required:

import threading
import time

def printit():
   now = time.strftime("%I:%m:%S %p")
   threading.Timer(5.0, printit).start()
   print (now)

printit()
Nimantha
  • 6,405
  • 6
  • 28
  • 69
Ehsan Rahi
  • 61
  • 7