By default, pyglet only redraws the window when an event occurs, or when a time fires. To force pyglet to redraw at a fixed interval, schedule an update function:
> def update(dt): pass pyglet.clock.schedule_interval(update, 1.0/60.0) - Tristam On Sun, Dec 21, 2008 at 2:04 PM, Silentpolygon <[email protected]>wrote: > > Hello everybody, > > I have a strange experience made with this code: > > import pyglet > import time > > class ClockWindow(pyglet.window.Window): > def __init__(self): > super(ClockWindow, self).__init__() > > def on_draw(self): > self.clear() > self.label = pyglet.text.Label(str(time.time())) > self.label.draw() > > window = ClockWindow() > pyglet.app.run() > > The 'clock' is only running when i press a key and hold it. Is there > somerthing wrong with the on_draw function? because normaly it should > update the buffer on every frame automatically. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
