pythonpygamepygame-clock

pygame.time.Clock.get_fps does not exist


so I am trying to display my fps in game, but whenver I try to use the pygame.time.Clock.get_fps function, it says it does not exict as an atribute

I tried:

clock = pygame.time.Clock print(clock.get_fps()) print(pygame.time.clock.get_fps()) print(pygame.time.Clock.get_fps())

as you see, I am desperate


Solution

  • You missed the parenthesis here,

    clock = pygame.time.Clock #<=
    

    it should be

    clock = pygame.time.Clock()
    

    that way you can get the methods of the time.Clock() class, ie get_fps().