Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

wxpython - How do I use wx.GIFHandler's SaveAnimation method?

I have a python program that produces a sequence of wx.Image objects, and I would like to make an animated GIF out of them. I am trying to see if I can use wx.GIFHandler in wxPython to do this, but I can't figure out what to pass as the images argument. I was hoping I can avoid importing PIL or cv2, since I have already imported wx, and it seems to have built-in functionality to do this.

Here's the API reference:

SaveAnimation(self, images, stream, verbose=True, delayMilliSecs=1000)?

    Save the animated gif.

    Parameters

            images (ImageArray) – The image array object which is to be affected by this operation.

            stream (wx.OutputStream) – Opened output stream for writing the data.

            verbose (bool) – If set to True, errors reported by the image handler will produce LogMessages

            delayMilliSecs (int) – How long, in milliseconds, to wait between each frame.

    Return type
        bool

    Returns
        True if the operation succeeded, False otherwise.

According to the API reference for wx.GIFHandler SaveAnimation, the images argument takes an ImageArray, but the only reference I can find to it is in the C++ code here, which appears to be a reference to a C++ array of C++ wx.Image objects.

I've tried passing a python list, a wx.ImageList, and a numpy.array -- none of them seem to work.

Thanks in advance for any help I can get!

TL;DR: How do I create an ImageArray object to pass to SaveAnimation?

question from:https://stackoverflow.com/questions/65865323/how-do-i-use-wx-gifhandlers-saveanimation-method

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...