You could try regulating how much you load at a time by using an iterative
generator, for example:
import pyglet
class Example(pyglet.window.Window):
def __init__(self):
super(Example, self).__init__(640, 480, resizable=False, fullscreen=
False, caption="Example")
self.clear()
#value to load
self.value = None
#count what stage the generator is at
self.counter = 0
pyglet.clock.get_fps()
self.fps_display = pyglet.clock.ClockDisplay()
pyglet.clock.schedule_interval(self.update, .01)
#update
def update(self,dt):
try:
self.generator().next()
except StopIteration:
pass
self.draw()
#draw screen
def draw(self):
self.clear()
self.fps_display.draw()
#content loader
def generator(self):
if self.counter == 0:
self.value = []
for a in range(0,1000,1):
self.value.append([])
self.counter += 1
yield 1
elif self.counter < 1001:
for a in range(0,1000,1):
self.value[self.counter-1].append([])
self.counter += 1
if self.counter%100.0 == 0:
print 'iterating'
yield 1
if __name__ == '__main__':
window = Example()
pyglet.app.run()
--
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 https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.