首页 > 解决方案 > wxPython - 带有 Gif 的 AnimationCtrl 导致内核崩溃

问题描述

我使用这段代码试图在我的 GUI 中显示和动画 Gif。但是如果我运行它,我的内核会立即死亡。

我做错了什么?

这是我的代码:

import wx
from wx.adv import Animation, AnimationCtrl

class TestPanel(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        gif_fname = wx.adv.Animation("Test.gif")
        gif = wx.adv.AnimationCtrl(parent=self,anim=gif_fname)
        gif.GetAnimation()

        self.gif = gif

        self.gif.Play()

        sizer.Add(gif)
        self.SetSizerAndFit(sizer)
        self.Show()

if __name__ == '__main__':
    test=wx.App()
    TestPanel(None)
    test.MainLoop()

标签: pythonpython-3.xanimationwxpythongif

解决方案


推荐阅读