Leif, 

I put together a quick example. While it doesn't crash, It does illustrate 
what may be the root cause:  animations are not being unscheduled properly. 
When changing a sprite's img/animation, it will call clock.unschedule(). 
The print function in the example code shows that the list of scheduled 
functions keeps growing every time you change one. Hope this helps! 

(It would be a lot cleaner to use a proper animation, but I just mocked 
this up using transforms of the included png in the pyglet repo)

import pyglet

window = pyglet.window.Window()
batch = pyglet.graphics.Batch()

image = pyglet.image.load("examples/pyglet.png")
image.anchor_x = image.width//2
image.anchor_y = image.height//2

frames = []
for i in range(4):
    angle = i * 90 % 360
    img = image.texture.get_transform(rotate=angle)
    frames.append(img)
ani = pyglet.image.Animation.from_image_sequence(frames, 0.08)
ani2 = pyglet.image.Animation.from_image_sequence(frames, 0.2)

sprite = pyglet.sprite.Sprite(ani, x=window.width//2, y=window.height//2, 
batch=batch)


@window.event
def on_key_press(key, mod):
    if key == pyglet.window.key.SPACE:
        sprite.image = ani2
        print(pyglet.clock.get_default()._schedule_interval_items)


@window.event
def on_draw():
    window.clear()
    batch.draw()


if __name__ == "__main__":
    pyglet.app.run()




On Tuesday, February 21, 2017 at 1:25:11 AM UTC+9, Leif Theden wrote:
>
> I wrote the experimental clock.  Thanks for the input.  I realize I've 
> been silent for a long time, but with some details about the issues, I can 
> work towards better compatibility.
>
> Leif
>
> On Mon, Feb 20, 2017 at 7:09 AM, Benjamin Moran <[email protected] 
> <javascript:>> wrote:
>
>>  I've actually come across some issues myself, so this will need some 
>> additional work before merging.  The first is a fairly consistent crash 
>> when changing a sprite's animation. The second is that the animation speed 
>> is not consistent. It's off enough to be visually obvious, so it should be 
>> tweaked a bit. 
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "pyglet-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/pyglet-users/_0eLxtKfUy4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/pyglet-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.

Reply via email to