Luca
Luca

Reputation: 1350

Animated gif with wxpython phoenix

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.

Upvotes: 3

Views: 2064

Answers (1)

Rolf of Saxony
Rolf of Saxony

Reputation: 22453

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

Upvotes: 5

Related Questions