[wxPython-users] Re: wx.animate.Animation Question
Robin Dunn
robin at alldunn.com
Fri Mar 9 11:29:48 PST 2007
Hannes Mueller wrote:
> Grzegorz Adam Hankiewicz wrote:
>> Hannes Mueller wrote:
>>> ani = wx.animate.Animation("filename.gif")
>>>
>>> I want to distribute this application, and I want to reduce the
>>> amount of files i have to distribute and that can lead to "user
>>> induced errors".
>>> Is there any way I can store the gif information in the code and make
>>> the Animation constructor read it from there?
>>
>> wxPython provides wx.tools.img2py, which can be called to convert .png
>> files into importable python source code. I guess it works with .gif
>> too, or there's some other similar script for gifs which you could use.
>>
>
> Thanks, I already tried somethin in that direction, the problem is
> however that the constructor for the Animation class only accepts
> strings or unicode strings as parameter. I can't even give it an already
> open file pointer.
>
> Anyone knows how to work around this?
The Animation class has a Load method that can take a stream, so you can
do it something like this:
anim = wx.animate.Animation()
anim.Load(stream)
ctrl = wx.animate.AnimationCtrl(parent, -1, anim)
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list