Socket
Book a DemoInstallSign in
Socket

tcod-clock

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcod-clock

Track and limit framerate of a program.

Source
pipPyPI
Version
1.0.1
Maintainers
1

About

PyPI PyPI - License Documentation Status codecov

Libtcod used to include a global framerate limiter which was eventually deprecated. This module was created as a replacement for that feature.

import time

import tcod.clock


FPS = 30

end_time = time.time() + 3  # Loop for 3 seconds.

clock = tcod.clock.Clock()
while time.time() < end_time:
    clock.sync(1 / FPS)  # This loop will run at 30 FPS until interrupted.

# Timing information can be checked.  Check the docs for more info.
print(f"{clock.last_fps=}")
print(f"{clock.min_fps=}")
print(f"{clock.max_fps=}")
print(f"{clock.mean_fps=}")
print(f"{clock.median_fps=}")

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts