pygame.time.Clock.get_fps does not exist

295 Views Asked by At

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

1

There are 1 best solutions below

0
nasc On BEST ANSWER

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().