Get the running Sketch’s current frame rate.


1def draw():
2    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)
3    py5.println(py5.get_frame_rate())


Get the running Sketch’s current frame rate. This is measured in frames per second (fps) and uses an exponential moving average. The returned value will not be accurate until after the Sketch has run for a few seconds. You can set the target frame rate with frame_rate().

This method provides the same information as Processing’s frameRate variable. Python can’t have a variable and a method with the same name, so a new method was created to provide access to that variable.

Underlying Processing method: getFrameRate


get_frame_rate() -> float

Updated on November 12, 2021 11:30:58am UTC