wx.animate.Animation Question
Hannes Mueller
hannes.mueller at gmail.com
Mon Mar 12 06:23:30 PDT 2007
Robin Dunn wrote:
> 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)
>
I am sorry, I tried to understand it, but I could not implement it...
How do I create a correctly formatted stream from my gif file?
And how can I get the stream directly from the code, without loading a
gif from the harddrive?
Hannes
More information about the wxpython-users
mailing list