3

I was trying to put an animated gif in a wxpython panel but apparently there is no animarion nor adv package in my wxpython version:

In [1]: import wx
In [2]: wx.version()
Out[2]: '4.0.1 gtk3 (phoenix)'

Then i tried to use the gif as a wx.Bitmap but of course it would not play. I know that according to phoenix documention:

https://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html

the gif handler class is MISSING, but i was wondering if there is any way to use a gif (threding maybe?) in phoenix.

1 Answer 1

5

wx.adv contains Animation and AnimationCtrl
Ripped out of the demo's

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)
        anim = Animation('/home/rolf/loveyourjob5qj.gif')
        ctrl = AnimationCtrl(self, -1, anim)
        ctrl.Play()
        sizer.Add(ctrl)
        self.SetSizerAndFit(sizer)
        self.Show()

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

enter image description here

6
  • 1
    I tried to use your code, do you have any idea why my kernel crashes? I tried different Gif files, my Wxpython version is 4.0.4 msw (phoenix) wxWidgets 3.0.5 and i use Python 3.
    – K-Doe
    Commented May 7, 2019 at 11:44
  • @K-Doe None at all. I re-tested this code on Linux python 3.6.7 wx 4.0.4 gtk2 (phoenix) wxWidgets 3.0.5. I also tested it against wx 4.0.1 gtk3. Both work without issue. You don't say how your kernel "crashes" Commented May 7, 2019 at 13:18
  • Thank you for testing. Sadly my IDE doesnt give me any further information. If i run the code i see that it starts, but no window appears and after ~2sec it shows Kernel died, restarting not more.
    – K-Doe
    Commented May 7, 2019 at 13:20
  • @K-Doe Have you considered that it may be your environment? What happens it you run it on the command line? Commented May 7, 2019 at 14:23
  • Thats it. I tested on two computer and both had the same problem. On the third, at home, everything went well. Now i know its the environment. Thank you!
    – K-Doe
    Commented May 8, 2019 at 15:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.