[wxPython-users] Best way to display a series of PNG frames as
an animation?
Gloria
strangest at comcast.net
Mon Feb 4 11:16:14 PST 2008
Excellent, thank you. I will give this a try.
Gloria
>> Hi there,
>> I am trying to find the best way to display a series of .png frames
>> in series. I want to control the timing, looping, etc. similar to
>> your animated GIF interface. I don't see PNG support in the animate()
>> methods, am I missing something?
>> I have also attempted doing the display myself in a threaded wxpython
>> app, but I only see each image if I set an interactive breakpoint,
>> wait for it to draw, and hit "c" for continue. There must be a better
>> way.
>
> Take a look at the wx.lib.throbber module. You may be able to make a
> custom version in a derived class that handles having variable
> durations between frames, otherwise it will serve as an example of
> what you need to do.
>
> In essence you'll want to do things something like this:
>
> * Have a widget with a EVT_PAINT handler that draws the current frame
> of the animation sequence in the handler.
>
> * The widget will have a timer that is initially set to the time
> duration between the first and second frames in the sequence.
>
> * When the timer expires the handler will change the "current" frame
> to the next in the sequence, wrapping around to the beginning if
> needed, restarting the timer with the next duration, and then call
> Refresh so a new paint event will be sent so the new image will be
> drawn. (You may want to add an Update() there too so the paint will
> happen immediately.)
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list