Much thanks guys - and happy holidays :D On Thursday, December 27, 2012 11:26:03 PM UTC+7, swiftcoder wrote: > > On Sat, Dec 22, 2012 at 12:40 AM, Ricky Christie > <[email protected]<javascript:> > > wrote: > >> So I was trying out pyglet1.2alpha in my Snow Leopard. >> Either the pyglet.clock.tick() method doesn't get called periodically or >> the draw method doesn't. >> I wrote a code that should display incrementing number on each draw. It >> does increment but only after a long while. >> >> import pyglet >> >> class TestTick(object): >> def start(self): >> self.x = 1 >> window = pyglet.window.Window() >> >> @window.event >> def on_draw(): >> window.clear() >> self.x += 1 >> label = pyglet.text.Label('Hello, world ' + str(self.x)) >> label.draw() >> print('draw called') >> >> pyglet.app.run() >> >> test = TestTick() >> test.start() >> >> Am I using it wrong here? >> > > As Peter says, pyglet won't draw until it thinks there is a reason to (in > your case, probably when you move the mouse). > > If you want a constant redraw (such as for a game), then just register an > empty update function: > > def update(dt): > pass > pyglet.clock.schedule_interval(update, 1.0/30.0) > > > -- > Tristam MacDonald > Software Development Engineer, Amazon.com > http://swiftcoder.wordpress.com/ >
-- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To view this discussion on the web visit https://groups.google.com/d/msg/pyglet-users/-/ac2piUIj81oJ. 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.
