Skip to content

Instantly share code, notes, and snippets.

@Torxed
Created June 9, 2017 17:46
Show Gist options
  • Save Torxed/9f001a5ae912a5649d3f9f7fedada66b to your computer and use it in GitHub Desktop.
Save Torxed/9f001a5ae912a5649d3f9f7fedada66b to your computer and use it in GitHub Desktop.
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