Created
June 9, 2017 17:46
-
-
Save Torxed/9f001a5ae912a5649d3f9f7fedada66b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyglet | |
from time import time | |
window = pyglet.window.Window() | |
last_update = time() | |
def update(*args): | |
global last_update | |
print('Update was called every:', time()-last_update,'seconds') | |
last_update = time() | |
@window.event | |
def on_draw(): | |
dt = pyglet.clock.tick() | |
print('Last time tick() was called:', dt,'seconds ago') | |
pyglet.clock.schedule_interval(update, 1.0 / 60.0) | |
pyglet.app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment