Hi All.
I'm trying to set up a scheduled function which will be called every
one second in the event loop. My code is like this:
import pyglet as pg
class MazeWindow(pg.window.Window):
def __init__(self):
super(MazeWindow, self).__init__()
self.i = 0
self.label = pg.text.Label('start', x=200, y=50)
self.fps = pg.clock.ClockDisplay()
pg.clock.schedule_interval(self.my_timer, 1.0)
#pg.clock.schedule(self.my_timer)
def on_draw(self):
self.clear()
self.label.draw()
self.fps.draw()
def my_timer(self, dt):
self.i = self.i + 1
self.label.text = "counter %d" % (self.i,)
#print "my_timer %d" % (self.i,)
win = MazeWindow()
pg.app.run()
But the effect is that counter is updated only when there are events
going from user, for example when I'm moving the mouse cursor over the
window. Other wise (when I don't touch the computer), counter is not
increased, my_timer() is not called. It looks like window is not
refreshed either.
How should I implement this?
Thanks,
toomyem
--
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.