Hannes Mueller wrote:
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?
Okay, I found that it accepts "wx.InputStream" or a File-Like object.
I try the following:
f = open("path_to/file.gif")
ani = wx.animate.Animation()
ani.Load(f)
--> python crashes
it also crashes on
instr = wx.InputStream(f)
What am I doing wrong?
Hannes