Sure, something like this perhaps?
import pyglet
from pyglet import clock
from pyglet.window import key
from pyglet.gl import *
pyglet.options['debug_gl'] = False
class Test(pyglet.window.Window):
def __init__(self):
super(Test, self).__init__(640, 480, resizable=False, fullscreen=
False, caption="Test")
self.clear()
#setup the tick counter and Frames Per Second counter
self.dt_count = clock.tick()
self.fps_display = pyglet.clock.ClockDisplay()
#start main loop
self.update()
def update(self):
while not self.has_exit:
#Make sure events are timed properly
self.dt_count += clock.tick()
#timer rate for updating code
if self.dt_count >= 0.025:
self.dt_count = 0
#render to screen and flip frame buffers
self.draw()
#manually dispatch window events
self.dispatch_events()
def draw(self):
#clear screen
self.clear()
#draw frames per second
self.fps_display.draw()
#flip frame buffer
self.flip()
def on_key_press(self,symbol,modifiers):
if symbol == key.ESCAPE:
self.close()
if __name__ == '__main__':
window = Test()
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.