print fps in while loop python

Solutions on MaxInterview for print fps in while loop python by the best coders in the world

showing results for - "print fps in while loop python"
Mattia
03 Jan 2018
1import time
2
3start_time = time.time()
4x = 1 # displays the frame rate every 1 second
5counter = 0
6while True:
7
8    ########################
9    # your fancy code here #
10    ########################
11
12    counter+=1
13    if (time.time() - start_time) > x :
14        print("FPS: ", counter / (time.time() - start_time))
15        counter = 0
16        start_time = time.time()
17
similar questions
queries leading to this page
print fps in while loop python